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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
GAURAV7781
Helper III
Helper III

How to create slicer with categories

I have a categories

Categories

A

B

C

D

E

 

Desired category output is

A,B = Car

A,B,E=Bike

A,B,C,D,E=Plane

2 ACCEPTED SOLUTIONS
CNENFRNL
Community Champion
Community Champion

@GAURAV7781 I have a coarse solution if I understand your issue correctly.

Measure =
VAR __selected =
    CONCATENATEX ( ALLSELECTED ( Categories[Category] ), Categories[Category] )
RETURN
    SWITCH (
        __selected,
        "AB", "Car",
        "ABE", "Bike",
        "ABCDE", "Plane",
        "Other option"
    )

Screenshot 2020-09-18 002739.png


Thanks to the great efforts by MS engineers to simplify syntax of DAX! Most beginners are SUCCESSFULLY MISLED to think that they could easily master DAX; but it turns out that the intricacy of the most frequently used RANKX() is still way beyond their comprehension!

DAX is simple, but NOT EASY!

View solution in original post

RobbeVL
Impactful Individual
Impactful Individual

Hi ,

This is the least to say a creative solution to the problem! 🙂 
I'm pretty sure if you try "SW" instead of "WS" it will work.

If it doesnt, i'll help you with a different approach.

 

Regards,

Robbe

View solution in original post

5 REPLIES 5
CNENFRNL
Community Champion
Community Champion

@GAURAV7781 I have a coarse solution if I understand your issue correctly.

Measure =
VAR __selected =
    CONCATENATEX ( ALLSELECTED ( Categories[Category] ), Categories[Category] )
RETURN
    SWITCH (
        __selected,
        "AB", "Car",
        "ABE", "Bike",
        "ABCDE", "Plane",
        "Other option"
    )

Screenshot 2020-09-18 002739.png


Thanks to the great efforts by MS engineers to simplify syntax of DAX! Most beginners are SUCCESSFULLY MISLED to think that they could easily master DAX; but it turns out that the intricacy of the most frequently used RANKX() is still way beyond their comprehension!

DAX is simple, but NOT EASY!

@CNENFRNL hi is there a way to make desired column as slicer . My user want to select car and bike as filter 

I tried W, S & rest are working 

only when i am select WS together not working @CNENFRNL WS Not wokingWS Not woking

 

RobbeVL
Impactful Individual
Impactful Individual

Hi ,

This is the least to say a creative solution to the problem! 🙂 
I'm pretty sure if you try "SW" instead of "WS" it will work.

If it doesnt, i'll help you with a different approach.

 

Regards,

Robbe

@GAURAV7781 I see many other viz on this page, thus the result of your Area viz is an integrated effects under all possible filtering on viz. Pls try this if you'd like to make Area viz independant of other filterings,

 

Measure =
VAR __selected =
    CONCATENATEX (
        CALCULATETABLE ( ALLSELECTED ( Categories[Category] ), ALLEXCEPT ( Categories, Categories[Category] ) ),
        Categories[Category]
    )
RETURN
    SWITCH (
        __selected,
        "AB", "Car",
        "ABE", "Bike",
        "ABCDE", "Plane",
        "Other option"
    )

 

Better to attach a mockup file for further debugging if the issue lingers.


Thanks to the great efforts by MS engineers to simplify syntax of DAX! Most beginners are SUCCESSFULLY MISLED to think that they could easily master DAX; but it turns out that the intricacy of the most frequently used RANKX() is still way beyond their comprehension!

DAX is simple, but NOT EASY!

Helpful resources

Announcements
July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 community update carousel

Fabric Community Update - June 2025

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