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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Quinnie2017
Helper II
Helper II

DAX Weighted Average works but does not work as expected with slicer

Hi - I have a DAX weighted average formula that works without a slicer.

 

When I add a slicer for Markets the DAX continues to calculate at the All Markets level versus the market level.

 

Can you help me adjust my DAX to consider the slicer?

 

Weighted Avg Impact =
SUMX(
SUMMARIZE('Day Key','Day Key'[KBP PD]),
DIVIDE(
CALCULATE([Avg Impact]*COUNTA(MASTER[Store]))
,
CALCULATE(COUNT('Cost Center'[Cost_CenterKey]),'Cost Center'[CC Type]="Store")
))
 
Exhibit 1: DAX that works at All Markets level
Quinnie2017_2-1625695716348.png
Exhibit 2: DAX does not adjust to only Atlanta when selecting Atlanta market (still calculates using All Markets)
Quinnie2017_3-1625695735583.png

 

1 REPLY 1
v-janeyg-msft
Community Support
Community Support

Hi, @Quinnie2017 

 

It‘s not clear that the field on the slicer is on which table. You can try to use allselected() function in the formula involving that table.

Like this:

Weighted Avg Impact =
SUMX (
    SUMMARIZE ( ALLSELECTED ( 'Day Key' ), 'Day Key'[KBP PD] ),
    DIVIDE (
        CALCULATE ( [Avg Impact] * COUNTA ( MASTER[Store] ), ALLSELECTED ( 'MASTER' ) ),
        CALCULATE (
            COUNT ( 'Cost Center'[Cost_CenterKey] ),
            'Cost Center'[CC Type] = "Store",
            ALLSELECTED ( 'Cost Center' )
        )
    )
)

[Avg Impact] seems to be a measure, it may also need to change.

If it doesn't solve your problem, Can you share a sample file and feel free to ask me.

 

Best Regards

Janey Guo

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.