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

A new Data Days event is coming soon! This time we’re going bigger than ever. Fabric, Power BI, SQL, AI and more. Don't miss out.

Reply
DJSwezey
Helper I
Helper I

Measure breaks matrix when page filtered by multiple values

I am building a profit/margin dashboard for multiple clients.

I am referencing one table for all of this; 'Budgets'.
I have a separate page for each client and each page is filtered by the client code.

My calculation works great for individual clients, but the moment I filter by more than one client code on the page my matrix breaks and says the following:

DJSwezey_0-1710966495423.png

There are two clients that require a different Earned formula. If the current page filter equals "H1" or "M1" then do Earned_Overall, otherwise do Earned_Market. If I filter the page for two markets (Lets say "A1" and "H1") the matrix breaks.

DJSwezey_2-1710967054371.png

 

Earned = 
VAR Earned_Overall =
        [Billing]
        - IF (
            [Delivery%] >= [Guarantee%],
            0,
            ( [Guarantee%] - [Delivery%] ) * [Billing] 
        )
VAR Earned_Market =
    SUMX (
        SUMMARIZE ( Budgets, Budgets[BuyspecName], Budgets[Market], "Value", [ECalc] ),
        [Value]
    )
RETURN
    SWITCH (
        TRUE (),
        VALUES ( Budgets[cclient2] ) = "H1" || VALUES ( Budgets[cclient2] ) = "M1", 
        SWITCH ( TRUE (), ISINSCOPE ( Budgets[BuyspecName] ), BLANK (), Earned_Overall),
        Earned_Market
    )
ECalc = 
VAR Earned = 
    [Billing]
        - IF (
            [Delivery%] >= [Guarantee%],
            0,
            ( [Guarantee%] - [Delivery%] ) * [Billing] 
        )

'Budgets' table

DJSwezey_1-1710966832735.png

 

 

I need to get this Earned formula to function when multiple client codes are filtered in.

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @DJSwezey 

You can try the following measure.

Earned =
VAR Earned_Overall =
    [Billing]
        - IF (
            [Delivery%] >= [Guarantee%],
            0,
            ( [Guarantee%] - [Delivery%] ) * [Billing]
        )
VAR Earned_Market =
    SUMX (
        SUMMARIZE ( Budgets, Budgets[BuyspecName], Budgets[Market], "Value", [ECalc] ),
        [Value]
    )
RETURN
    SWITCH (
        TRUE (),
        SELECTEDVALUE ( Budgets[cclient2] ) = "H1"
            || SELECTEDVALUE ( Budgets[cclient2] ) = "M1", IF ( NOT ( ISINSCOPE ( Budgets[BuyspecName] ) ), Earned_Overall ),
        Earned_Market
    )

Best Regards!

Yolo Zhu

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

View solution in original post

1 REPLY 1
Anonymous
Not applicable

Hi @DJSwezey 

You can try the following measure.

Earned =
VAR Earned_Overall =
    [Billing]
        - IF (
            [Delivery%] >= [Guarantee%],
            0,
            ( [Guarantee%] - [Delivery%] ) * [Billing]
        )
VAR Earned_Market =
    SUMX (
        SUMMARIZE ( Budgets, Budgets[BuyspecName], Budgets[Market], "Value", [ECalc] ),
        [Value]
    )
RETURN
    SWITCH (
        TRUE (),
        SELECTEDVALUE ( Budgets[cclient2] ) = "H1"
            || SELECTEDVALUE ( Budgets[cclient2] ) = "M1", IF ( NOT ( ISINSCOPE ( Budgets[BuyspecName] ) ), Earned_Overall ),
        Earned_Market
    )

Best Regards!

Yolo Zhu

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

Helpful resources

Announcements
May Power BI Update Carousel

Power BI Monthly Update - May 2026

Check out the May 2026 Power BI update to learn about new features.

Fabric SQL PBI Data Days

Data Days 2026 coming soon!

Sign up to receive a private message when registration opens and key events begin.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.