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
singhal14
Helper I
Helper I

DAX measure to change the way filters are getting affected.

Hi everone,

 

We are trying a scenario where using DAX measure we are changing the filtered value .Here is the screenshot of the table. Here we are calculating the sum of value column by using col1 and col2. So when we place col1 in the slicer and chose a the filtering should be done on the basis of col2 and sum of valueshould be 30 . 

If you need any clarification on this problem, please let us know.Any help would be useful.

 

 

Thanks

Screenshot (72).png

 

1 ACCEPTED SOLUTION
v-shex-msft
Community Support
Community Support

Hi @singhal14,

 

According to your description, you want to use slicer to choose the col2 and show sum of the value,right?

 

If this is a case, you can refer to below steps to achieve your requirement.

 

Original table:

Capture.PNG

 

Calculate table:

Table = VALUES(Table1[col1])

 

Add a measure to new table to get slicer's value.

Selected = if(HASONEVALUE('Table'[col1]),VALUES('Table'[col1]),BLANK())

 

Add measure to original table to calculate summary value.

TotalValue =
var temp=LOOKUPVALUE(Table1[col2],Table1[col1],[Selected])
return
SUMX(FILTER(ALL('Table1'),'Table1'[col2]=temp),[value])

 

Add the relationship between original table and calculate table.

Capture4.PNG

 

Create visuals.

 

Slicer:

Capture2.PNG

 

Table visual:

Capture3.PNG

 

Result:

Capture5.PNG

 

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

View solution in original post

1 REPLY 1
v-shex-msft
Community Support
Community Support

Hi @singhal14,

 

According to your description, you want to use slicer to choose the col2 and show sum of the value,right?

 

If this is a case, you can refer to below steps to achieve your requirement.

 

Original table:

Capture.PNG

 

Calculate table:

Table = VALUES(Table1[col1])

 

Add a measure to new table to get slicer's value.

Selected = if(HASONEVALUE('Table'[col1]),VALUES('Table'[col1]),BLANK())

 

Add measure to original table to calculate summary value.

TotalValue =
var temp=LOOKUPVALUE(Table1[col2],Table1[col1],[Selected])
return
SUMX(FILTER(ALL('Table1'),'Table1'[col2]=temp),[value])

 

Add the relationship between original table and calculate table.

Capture4.PNG

 

Create visuals.

 

Slicer:

Capture2.PNG

 

Table visual:

Capture3.PNG

 

Result:

Capture5.PNG

 

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

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.