Forum Discussion
corange
6 years agoPost Patron
Filter on Aggregation
Hi POWER BI Team, I need your help on a project and I will try my best to explain the desired outcome. My company is structured into 3 Business Units (BUs) - BU A, BU B, BU C, and we have a...
v-yingjl
6 years agoCommunity Support
Hi corange ,
If only single or all slicers are considered to be selected, I think the below measure should work:
Measure =
VAR _avg =
CALCULATE (
AVERAGEX (
FILTER ( 'Table', 'Table'[value] >= 3 || 'Table'[BUs] <> "BU A" ),
'Table'[value]
),
ALLEXCEPT ( 'Table', 'Table'[BUs], 'Table'[state] )
)
VAR _avgA =
CALCULATE (
AVERAGEX (
FILTER ( 'Table', NOT ( 'Table'[value] < 3 && 'Table'[BUs] = "BU A" ) ),
'Table'[value]
),
ALLEXCEPT ( 'Table', 'Table'[BUs], 'Table'[state] )
)
VAR _avgother =
AVERAGE ( 'Table'[value] )
RETURN
IF (
HASONEFILTER ( 'Table'[BUs] ),
IF (
NOT ( ISFILTERED ( 'Table'[BUs] ) ),
_avg,
IF ( SELECTEDVALUE ( 'Table'[BUs] ) = "BU A", _avgA, _avgother )
),
_avg
)
Attached sample file: Filter on Aggreation.pbix
Best Regards,
Yingjie Li
If this post helps then please consider Accept it as the solution to help the other members find it more quickly.