March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early bird discount ends December 31.
Register NowBe one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now
Hello!
I'm having some trouble regarding the logic of my slicer.
I'm aware that to create a slicer, you have to drag the column and the unique values of that certain column will serve as choices for your slicer. But I have a different case.. I want to have a slicer (filter for my materials) where the options are:
I have a list of materials (A to Z) and I created a calculated column:
Material Filter = if(Query1[MATERIAL] <> "B", "All materials except material B", "All materials")
But I think this is wrong haha! Because if I choose "All materials" only the values for material B will appear. Is there a way where I can have a DAX measure as a slicer filter? How can I create my own slicer with this logic?
Thanks a lot in advance!
Solved! Go to Solution.
Hi @crln-blue ,
Based on your description, you can do some steps as follows.
1. create a table that contains only "All materials except material B" and "All materials". (I used "Enter Data" option)
2. create a measure and drag it to the filter of the table visual.(is equal to 1)
Measure =
var x1=SELECTEDVALUE('slicer'[S])
var x2=IF(MAX('Query1'[material])<>BLANK(),"All materials")
var x3=IF(MAX('Query1'[material])<>"B","All materials except material B")
return
IF(x1="All materials",1,IF(x1=x3,1,0))
Result:
Hope that's what you were looking for.
Best Regards,
Yuna
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @crln-blue ,
I'm glad that I can help you resolve this issue. The max function in this measure is used to define the exact value of each row. The value of measure must be calculated according to the context. The logic you gave is that everything except B is "All materials except material B", and the rest is only B, so only B is called "All materials". My method is to create two different variables that will show different values when different conditions are met. So I think the MAX function is not the cause of the error.
Best Regards,
Yuna
Hi @crln-blue ,
I'm glad that I can help you resolve this issue. The max function in this measure is used to define the exact value of each row because the value of measure should be calculated according to the context.
Best Regards,
Yuna
Hi @crln-blue ,
Based on your description, you can do some steps as follows.
1. create a table that contains only "All materials except material B" and "All materials". (I used "Enter Data" option)
2. create a measure and drag it to the filter of the table visual.(is equal to 1)
Measure =
var x1=SELECTEDVALUE('slicer'[S])
var x2=IF(MAX('Query1'[material])<>BLANK(),"All materials")
var x3=IF(MAX('Query1'[material])<>"B","All materials except material B")
return
IF(x1="All materials",1,IF(x1=x3,1,0))
Result:
Hope that's what you were looking for.
Best Regards,
Yuna
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Thanks @Anonymous ! This solved my problem. I did this but I did not use the MAX function for checking the material that's why my slicer is not reflecting in the matrix.
I just have a question, what's the MAX function in material for? I just want to understand the measure. Thanks again!
@crln-blue you can surely have a visual level filter for the slicer, read this post.
Check my latest blog post Compare Budgeted Scenarios vs. Actuals I would ❤ Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos to whoever helped to solve your problem. It is a token of appreciation!
⚡Visit us at https://perytus.com, your one-stop-shop for Power BI-related projects/training/consultancy.⚡
Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!
Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo
If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤
Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.
Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.
User | Count |
---|---|
124 | |
87 | |
85 | |
70 | |
51 |
User | Count |
---|---|
205 | |
153 | |
97 | |
79 | |
69 |