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

Get certified in Microsoft Fabric—for free! For a limited time, the Microsoft Fabric Community team will be offering free DP-600 exam vouchers. Prepare now

Reply
NourJ
Helper III
Helper III

Constraint values in multiselect slicer

Hi,
This is my second post on this topic I hope I will get an answer as I didn't receive any for the previous one,
My issue is with the multi-select slicer should be conditioned 
some values in my slicer should not be selected together example:

The slicer column is a distinct value:
A

B

C

D
E
the logic I need to apply is:
If A and or B is selected whether alone or with others but not D, then hide or remove D, and vice versa if D is selected then remove or hide A and B whether D is selected alone or with others

any help will be appreciated.

2 REPLIES 2
Sahir_Maharaj
Super User
Super User

Hello @NourJ,

 

Create a measure that checks if the selected values in the slicer contain either "A" or "B" and if they do, the measure will remove "D" from the selection. Similarly, if the selected values contain "D", the measure will remove "A" and "B" from the selection.

 

Selected Values = 
VAR SelectedValues = VALUES(Table[Column])
RETURN
IF (
    CONTAINSSTRING(CONCATENATEX(SelectedValues, Table[Column], ","), "A") 
        || CONTAINSSTRING(CONCATENATEX(SelectedValues, Table[Column], ","), "B"),
    EXCEPT(SelectedValues, VALUES(Table[Column]), VALUES(Table[Column]) = "D"),
    IF (
        CONTAINSSTRING(CONCATENATEX(SelectedValues, Table[Column], ","), "D"),
        EXCEPT(SelectedValues, VALUES(Table[Column]), VALUES(Table[Column]) IN {"A", "B"}),
        SelectedValues
    )
)

 

 

I hope this helps! Let me know if you have any further questions.


Did I answer your question? Mark my post as a solution, this will help others!

If my response(s) assisted you in any way, don't forget to drop me a "Kudos" 🙂

Kind Regards,
Sahir Maharaj
Data Scientist | Data Engineer | Data Analyst | AI Engineer
P.S. Want me to build your Power BI solution? (Yes, its FREE!)
➤ Lets connect on LinkedIn: Join my network of 15K+ professionals
➤ Join my free newsletter: Data Driven: From 0 to 100
➤ Website: https://sahirmaharaj.com
➤ Email: sahir@sahirmaharaj.com
➤ Want me to build your Power BI solution? Lets chat about how I can assist!
➤ Join my Medium community of 30K readers! Sharing my knowledge about data science and artificial intelligence
➤ Explore my latest project (350K+ views): Wordlit.net
➤ 100+ FREE Power BI Themes: Download Now
LinkedIn Top Voice in Artificial Intelligence, Data Science and Machine Learning

It doesn't work unforturnatly

Helpful resources

Announcements
OCT PBI Update Carousel

Power BI Monthly Update - October 2024

Check out the October 2024 Power BI update to learn about new features.

September Hackathon Carousel

Microsoft Fabric & AI Learning Hackathon

Learn from experts, get hands-on experience, and win awesome prizes.

October NL Carousel

Fabric Community Update - October 2024

Find out what's new and trending in the Fabric Community.