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
AmarB7
Regular Visitor

Help for Power BI slicers

Hi dear community,


I have a question about slicers in POWER BI desktop.

I would like to select a value in a slicer to show it in a visual,

but i want others values (that i didnt select) to appear in the visual as "Others".
Like there is "a", "b" and "c", i want to select "a" for the visual and i want "b" and "c" to appear as "others".

Can someone help me with it ?

Thank you guys a lot ! ❤️

2 ACCEPTED SOLUTIONS
johnt75
Super User
Super User

Check out this article by SQL BI. Although you don't need the TOPN functionality I think that their method for generating a row for Others will work in your situation too.

View solution in original post

PaulDBrown
Community Champion
Community Champion

Here is one way.

Create a Dimension table for the slicer values (in my example 'Category Table'), and then another disconnected table to use in the visual following the code along the lines of:

Table Cat with Other =
VAR _Other = { ( "Other", 10000000000 ) }
VAR _Cats =
    SUMMARIZE (
        FTable,
        FTable[Category],
        "Order", RANKX ( ALL ( FTable[Category] ), FTable[Category],, ASC )
    )
RETURN
    UNION ( _Cats, _Other )

other table.jpgModel.jpg

 

The measure you need for the visual:

Sum Value =
VAR _Sales =
    CALCULATE (
        SUM ( FTable[Value ] ),
        TREATAS ( VALUES ( 'Table Cat with Other'[Category] ), FTable[Category] )
    )
VAR _ALL =
    CALCULATE ( SUM ( FTable[Value ] ), ALL ( 'Category Table'[Category] ) )
VAR _OtherValue =
    _ALL
        - CALCULATE ( SUM ( FTable[Value ] ), ALLSELECTED ( 'Category Table'[Category] ) )
VAR _IfFilt =
    IF (
        ISINSCOPE ( 'Table Cat with Other'[Category] ),
        IF ( MAX ( 'Table Cat with Other'[Category] ) = "Other", _OtherValue, _Sales ),
        _ALL
    )
VAR _NotFilt =
    IF (
        AND (
            ISINSCOPE ( 'Table Cat with Other'[Category] ),
            MAX ( 'Table Cat with Other'[Category] ) = "Other"
        ),
        BLANK (),
        _Sales
    )
RETURN
    IF ( ISFILTERED ( 'Category Table'[Category] ), _IfFilt, _NotFilt )

Next set up the page with the slicer from the Category Dimension Table, and the visual with the category field from the disconnected table and you will get:

res.gif

Sample PBIX attached





Did I answer your question? Mark my post as a solution!
In doing so, you are also helping me. Thank you!

Proud to be a Super User!
Paul on Linkedin.






View solution in original post

3 REPLIES 3
AmarB7
Regular Visitor

Thank you a lot !

Both solutions seem to work

@johnt75 @PaulDBrown 

PaulDBrown
Community Champion
Community Champion

Here is one way.

Create a Dimension table for the slicer values (in my example 'Category Table'), and then another disconnected table to use in the visual following the code along the lines of:

Table Cat with Other =
VAR _Other = { ( "Other", 10000000000 ) }
VAR _Cats =
    SUMMARIZE (
        FTable,
        FTable[Category],
        "Order", RANKX ( ALL ( FTable[Category] ), FTable[Category],, ASC )
    )
RETURN
    UNION ( _Cats, _Other )

other table.jpgModel.jpg

 

The measure you need for the visual:

Sum Value =
VAR _Sales =
    CALCULATE (
        SUM ( FTable[Value ] ),
        TREATAS ( VALUES ( 'Table Cat with Other'[Category] ), FTable[Category] )
    )
VAR _ALL =
    CALCULATE ( SUM ( FTable[Value ] ), ALL ( 'Category Table'[Category] ) )
VAR _OtherValue =
    _ALL
        - CALCULATE ( SUM ( FTable[Value ] ), ALLSELECTED ( 'Category Table'[Category] ) )
VAR _IfFilt =
    IF (
        ISINSCOPE ( 'Table Cat with Other'[Category] ),
        IF ( MAX ( 'Table Cat with Other'[Category] ) = "Other", _OtherValue, _Sales ),
        _ALL
    )
VAR _NotFilt =
    IF (
        AND (
            ISINSCOPE ( 'Table Cat with Other'[Category] ),
            MAX ( 'Table Cat with Other'[Category] ) = "Other"
        ),
        BLANK (),
        _Sales
    )
RETURN
    IF ( ISFILTERED ( 'Category Table'[Category] ), _IfFilt, _NotFilt )

Next set up the page with the slicer from the Category Dimension Table, and the visual with the category field from the disconnected table and you will get:

res.gif

Sample PBIX attached





Did I answer your question? Mark my post as a solution!
In doing so, you are also helping me. Thank you!

Proud to be a Super User!
Paul on Linkedin.






johnt75
Super User
Super User

Check out this article by SQL BI. Although you don't need the TOPN functionality I think that their method for generating a row for Others will work in your situation too.

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.