Forum Discussion
Average over filtered table
- 3 years ago
Hi JL_007
I've attached an example PBIX of what I think you're looking for.
You can make use of the ALLSELECTED function to restore the "overall" filter context of the visual (for measures displayed directly in the visual).
In my example PBIX, I created these measures:
Value Sum = SUM ( Data[Value] )Current Year Monthly Average = CALCULATE ( AVERAGEX ( VALUES ( Data[Month] ), [Value Sum] ), ALLSELECTED (), Data[Year] = "Current" )In Current Year Monthly Average, ALLSELECTED () is applied to restore the overall filter context of the visual, and Year = "Current" is applied as an additional filter. With these filters applied, the monthly average is then calculated using AVERAGEX.
Note that months with no values (where [Value Sum] evaluates to blank) are ignored by AVERAGEX.
Does something like this work for you?
Regards
Hi JL_007
I've attached an example PBIX of what I think you're looking for.
You can make use of the ALLSELECTED function to restore the "overall" filter context of the visual (for measures displayed directly in the visual).
In my example PBIX, I created these measures:
Value Sum =
SUM ( Data[Value] )Current Year Monthly Average =
CALCULATE (
AVERAGEX (
VALUES ( Data[Month] ),
[Value Sum]
),
ALLSELECTED (),
Data[Year] = "Current"
)
In Current Year Monthly Average, ALLSELECTED () is applied to restore the overall filter context of the visual, and Year = "Current" is applied as an additional filter. With these filters applied, the monthly average is then calculated using AVERAGEX.
Note that months with no values (where [Value Sum] evaluates to blank) are ignored by AVERAGEX.
Does something like this work for you?
Regards
Well, that's just a perfect solution. Works like a charm!! Thank you, Owen!