Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Previous Month Reference Line

Hello,

I have a Gauge that shows AVG(Score), and I want to add a reference line that shows the Avg(Score) from the previous month.

I am selecting Month from a Date field in the table using Month(Date).

I have tried =AVG({<Month={$(=Max(Month(Date))-1)}>} [Score]) but this is not working and gives me the current month score.

Any ideas?

16 Replies
oknotsen
Master III
Master III

I am with Sunny T on this one:

I fear we can not help you unless you give us some sample data to look at.

May you live in interesting times!
Not applicable
Author

Here you go, hope you can see what I am trying to do.

antoniotiman
Master III
Master III

Hi Daniel,

try

AVG({<Date={'>=$(=MonthStart(Max(Date),-1))<=$(=MonthEnd(Max(Date),-1))'}>} [Holiday Overall])

Regards,

Antonio

Not applicable
Author

Hi Antonio,

This works, but only when no selection is made. If you make a selection the reference line disappears.

I guess the sample data has not been helpful?

antoniotiman
Master III
Master III

Try to add State 1

AVG({1<Date={'>=$(=MonthStart(Max(Date),-1))<=$(=MonthEnd(Max(Date),-1))'}>} [Holiday Overall])

Not applicable
Author

Thanks Antonio,

That worked, thank you.

The next question is, if I want a gauge that shows an average of multiple scores, would I just add them on?

AVG({1<Date={'>=$(=MonthStart(Max(Date),-1))<=$(=MonthEnd(Max(Date),-1))'}>} [Holiday Overall]+[Food Quality])

sunny_talwar

May be like this:

Avg({1<Date={'>=$(=MonthStart(Max(Date),-1))<=$(=MonthEnd(Max(Date),-1))'}>} RangeAvg([Holiday Overall], [Food Quality]))