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
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
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