Forum Discussion
Rolling average for only one group
Jrose , Try with help from two measures
Avg1= AVERAGEX( values('Table_1'[Year4]), CALCULATE(COUNT('Table_1'[person_id])))
m3YrAvg =calculate([Avg1],
FILTER(ALL('Table_1'[Year4]),
'Table_1'[Year4] <= MAX('Table_1'[Year4]) &&
'Table_1'[Year4] > (MAX('Table_1'[Year4])-3) && 'Table_1'[group] = MAX('Table_1'[group])
) )
Thanks for the suggestion. Unfortunately, it's not working.
The first calculation for average is giving numbers way too low and I can't tell what it is trying to average across.
I tried the second calculation anyway, and it won't recognize the table columns. The list that pops up as I enter the table name only shows the calculated fields and measures. I typed it anyway and get an error that says "A single value for column "group" cannot be determined. I used MAX to see if it would at least clear the error, which it didn't, but it doesn't make sense in this context anyway I need to be able to say something like
where group = "A".
The original calculation I have works, I would just like to be able to add what is in the filter pane to the calculation instead as I anticipate needing it for other metrics in the future.
I guess I'm not understanding why it insists on an aggregate rather than being able to filter (select) only records of a certain value. And why in this calculation it doesn't want to recognize regular data columns.