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
JimmyCruyp
Helper II
Helper II

Filter and slicer result

Hello, I am looking to create a formula that calculates a sum for certain attributes in a list of attributes based on whether or not I have selected those attributes in a slicer. I want a different result depending on whether they are selected or not. If they are selected, I want the sum of their values. If they are not selected, I want the values to be 0 for each attribute. If they are not selected, I still want them to appear in my result table, so I need to remove the interaction so that the slicer does not filter my result table. I want all attributes to appear in my result table, even those that are not selected, but with a value of 0 for those that are not selected. There are 100 attributes in the list, so I should not name them in my formula. There are sometimes multiple values for each attribute, so the sum needs to be calculated.

7 REPLIES 7
tamerj1
Super User
Super User

@JimmyCruyp 
In this case the Attribute slicer has to come from a dim table. Just create a dim table with all unique attributes and connect it to the main table then use the column from the dim table in the slicer. It should work if add (+ 0) to your measure.

I would like to find a solution without creating an additional table if possible?

No it is not possible. Try this:

Measure 2 =
VAR _sum = sum(Source[Value])
VAR _select = VALUES('Table'[Attribut])
RETURN if(SELECTEDVALUE(Source[Attribut]) IN _select,_sum,0)
 
andhiii079845_0-1679600072081.png

 

andhiii079845_1-1679600168357.png

 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Thanks, I tried this but only one table and it doesnt work. So there is no solution to do that without creating an additonal column?

No, because you want the filter the column and also modify the filter context. This is not possible. 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




andhiii079845
Super User
Super User

Can you please make a good data example with the underlaying data how with 1-2 different slicer value and how it should look like? Thank you 🙂





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




JimmyCruyp_0-1679393700648.png

For example if I filter in a slicer on attribut B and E (if I select only these attributes in my slicer)

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.

Top Solution Authors