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.

View discussion in a popup

Replying to:
Rai_BI
Helper IV

Dynamic summation according to the visual context

Dynamic summation according to the visual context

Hello friends,

In Power BI I have a table with two columns. The 'Seller1' column and the 'Seller2' column.

I intend to create three table visuals in which visual 1 will have the Seller1 column in context. In visual 2 you will have the Seller2 column in context and in visual 3 you will have the Seller1 and Seller2 column in context.

I need to create a single measure for the three visuals in which if the context contains the column Seller1 then return the measure [Goal 1] otherwise if the context contains the column Seller2 then return the measure [Goal 2] otherwise if the context contains the column Seller1 and also the Seller2 column then return the sum of the measures [Goal 1]+[Goal 2].


I made the following DAX measure below, but it does not correctly calculate the sum of the two measures [Meta1]+[Meta2] when the two columns are in the visual context.

DAX measurement...

Single Measure =
IF(
HASONEFILTER('customer table'[ID Seller1]),
[Measure 1],

IF(
HASONEFILTER('customer table'[ID Seller2]),
[Measure 2],

[Goal 1]+[Goal 2]
)
)

 I've attached an example pbix file so you can better understand what I'm looking for. Download