Hey Guys I am trying to do a calculation for a Running Average over the last month in a calculated field in Tableau. However I struggle with defining the last month range and adding it to the calculation. I thought of using
IF [date] >= DATEADD('month', -1, TODAY()) THEN RUNNING_AVG(SUM( IF [Entry Type] = 'Sale' THEN [Invoiced Quantity] ELSE 0 END )) END
However this is not working at all. I hope someone can help me out. Cheers
12 Answers
This worked out:
(SUM( IF [Entry Type] = 'Sale' AND [Posting Date] >= DATEADD('month',-1,TODAY()) THEN [Invoiced Quantity] ELSE 0 END ))
You do not have to write this into calculated field. Just filter date column and set that to be always filter for last 30 days, or last month. Then, use "calculated field" section just for calculation independently from the "date" which is already considered in filter section. Good luck
ncG1vNJzZmirpJawrLvVnqmfpJ%2Bse6S7zGiorp2jqbawutJobXBpYmeDcYSOrZibpJWWwm6vwKWarqSRqbKlecWinKWcXaSzbr7Up6Wippdirrex0ZqenmWWpL9uwMeeZKWZo6l6rrvNrZ8%3D