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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
PowerBIFin
Helper I
Helper I

Average Measure Unaffected by Context Filter

I would like to create an Average Measure which will retain the same value regardless of the context filter applied in the Visualisation Tables. For some reason, AllExcept doesn't seem to work on this particular measure I have created. I feel like the calculation is simple (especially on excel) but I seem to get stuck getting the correct DAX formula to the derive average. I have made it work on one visualization but can't get it to work on another. 

 

Measure: Peer Average Excluding Highest CDS) where Bank Product <> NA, Bank Type <> Child

1. Peer Average exc highest 

( SUM(BANK A:E)-BANK C ) / ( COUNT(BANK A:E) - 1 )

= 34

2. Relative to Peer Average 

Bank CDS / Peer Average exc highest

Bank A: 26/34

= .76

 

Look Up Table
BankTypeProduct
AParentDerivative
BParentCash
CParentDerivative
DParentCash
EParentDerivative
FChildNA
GChildNA

 

FACT TABLE

DateBankCDS

Peer Average exc highest

(MEASURE)

 

Relative to Peer Ave (MEASURE)
1-NovA26340.764706
1-NovB44341.294118
1-NovC67341.970588
1-NovD40341.176471
1-NovE26340.764706
1-NovF10  
1-NovG5  
2-NovA54541.009346
2-NovB71541.327103
2-NovC57541.065421
2-NovD60541.121495
2-NovE43540.803738
2-NovF50  
2-NovG26  

 

Visualisation 1 - My measure works in this visualisation.

BankCDSRelative to Peer Ave
A260.764706
B441.294118
C671.970588
D401.176471
E260.764706

Visualisation 2 - But same measure doesn't work in this.
Bank A

DateRelative to Peer Ave
1-Nov0.764706
2-Nov1.009346
3-Nov0.23
4-Nov0.456
5-Nov0.246
6-Nov1.233
7-Nov1.7

 

1 REPLY 1
amitchandak
Super User
Super User

@PowerBIFin , Try like

measure =
calculate( divide(sum(Table[CDS]),calculate(Average(Table[CDS]), filter(Table, allexpcept(Table, Table[CDS] >calculate(min(Table[CDS]), allexpcept(Table, Table[Date])))), allexpcept(Table, Table[Date]))) , values(Table[Date]))

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.