I have a measure, an SMA (Simple Mobile Average), and I need to calculate the MAX of it.
It should be simple, but I can't find what am I doing wrong.
In my case I have a table (allDataCSV). Each row represents an event, and it has a DATE. I can calculate the num of events that occur in when filtering the table (just count rows):
Count = COUNTROWS()
And my SMA is calculated this way:
CountSMA5Days = AVERAGEX(
DATESINPERIOD(allDataCSV[Day],LASTDATE(allDataCSV[Day]),-5,DAY),
[Count])
I want to calulate the MAX value of [CountSMA5Days]. It is a measure, not a field, so I cant use MAX. I have tried MAXX, with no luck:
MaxSMA = MAXX(allDataCSV,[CountSMA5Days])
It returns me '1', and I suppose it is because it evals row by row, and, in ths case, [CountSMA5Days] returns an average of 5 'ones'
Could you help me, please?
Thanks!
EDIT:
Thans to @Mik, who guided me to solution. The right meassure is:
MaxSMA = MAXX(
all(allDataCSV[Day])
,[CountSMA5Days]
)
That's it!!!
