Tableau Calculated Field of Running Average for the last month

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

1

2 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.enter image description hereGood luck

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

You Might Also Like