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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
Rai_BI
Helper IV
Helper IV

Dynamic summation

Hello friends,
Can anyone help me solve this problem?

In Power BI, I have a table with two columns. The 'Salesperson 1' column and the 'Salesperson 2' column.


I want to create three table visuals where visual 1 will have the Salesperson 1 column in context. In visual 2 you will have the Seller 2 column in context and in visual 3 you will have the Seller 1 and Seller 2 column in context.


I need to create a single unique measure for the three visual elements in which if the context contains the Salesperson 1 column then return the measure [Goal 1], otherwise, if the context contains the Salesperson 2 column then return the measure [Goal 2], otherwise, if the context contains the Salesperson 1 column and also the Salesperson 2 column, then return the sum of the measures [Goal 1]+[Goal 2].

I did the following DAX measurement below, I am not getting the desired result as the total grid value is returning BLANK. I don't understand because I'm using the SUMX function to force the value to appear.

Measure Test = 

VAR _Seller1inScope = HASONEFILTER('customer table'[Name Seller1])
VAR _Seller2inScope = HASONEFILTER('customer table'[Name Seller2])
VAR _Swith = 
    SWITCH(
        TRUE(),
        _Seller1inScope && NOT _Seller2inScope,
        SUMX(
            VALUES('customer table'[Name Seller1]),[Goal Seller 1]),
        
        _Seller2inScope && NOT _Seller1inScope,
        SUMX(
            VALUES('customer table'[Name Seller2]),[Goal Seller 2]),
                
        _Seller1inScope && _Seller2inScope,
        [Seller 1 + Seller 2]
        
    )


RETURN
_Swith

Sem tรญtulo.png

โ€ƒPlease download the PBIX file here

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Rai_BI ,

 

We can create a measure.

 

Measure 4 = 
SWITCH (
    TRUE (),
    SELECTEDVALUE ( 'Slicer'[Seller]) = "Name Seller1", SUMX ( VALUES ( 'customer table'[Name Seller1] ), [Measure Test] ),
    SELECTEDVALUE ( 'Slicer'[Seller]) = "Name Seller2",SUMX ( VALUES ( 'customer table'[Name Seller2] ), [Measure Test] ),
    SUMX(SUMMARIZE('customer table','customer table'[Name Seller1],'customer table'[Name Seller2],"measure",[Measure Test]),[measure])
)

 

We can create a slicer table.

 

Slicer = DATATABLE ( 
    "Seller", STRING, 
    {
        { "Name Seller1" },
        { "Name Seller2" }
        
    }
) 

 

Edit interactions for each slicer in the format pane and hide the slicers.

vtangjiemsft_0-1707363079181.pngvtangjiemsft_1-1707363097964.png

If you don't want to use a slicer, you can refer to this post to create a field parameter.

 

Best Regards,

Neeko Tang

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 @Rai_BI ,

 

We can create a measure.

 

Measure 4 = 
SWITCH (
    TRUE (),
    SELECTEDVALUE ( 'Slicer'[Seller]) = "Name Seller1", SUMX ( VALUES ( 'customer table'[Name Seller1] ), [Measure Test] ),
    SELECTEDVALUE ( 'Slicer'[Seller]) = "Name Seller2",SUMX ( VALUES ( 'customer table'[Name Seller2] ), [Measure Test] ),
    SUMX(SUMMARIZE('customer table','customer table'[Name Seller1],'customer table'[Name Seller2],"measure",[Measure Test]),[measure])
)

 

We can create a slicer table.

 

Slicer = DATATABLE ( 
    "Seller", STRING, 
    {
        { "Name Seller1" },
        { "Name Seller2" }
        
    }
) 

 

Edit interactions for each slicer in the format pane and hide the slicers.

vtangjiemsft_0-1707363079181.pngvtangjiemsft_1-1707363097964.png

If you don't want to use a slicer, you can refer to this post to create a field parameter.

 

Best Regards,

Neeko Tang

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

Helpful resources

Announcements
November Fabric Update Carousel

Fabric Monthly Update - November 2025

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

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

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.

Users online (25)