Forum Discussion

TomJWhite's avatar
TomJWhite
Frequent Visitor
5 years ago
Solved

Bin values for visual (Top 5 + 'Other') sorting

Hi there,   I have a donut visual showing total viewing hours for tv shows in my dataset. I created groups so that I could group shows not in the top 5 as 'Other'. I was hoping to move the 'Other' ...
  • Anonymous's avatar
    Anonymous
    5 years ago

    Hi TomJWhite ,

     

    Below is the sample data and solution created by myself.

    ValueID

    600 A
    300 B
    400 C
    500 D
    250 E
    350 F

     

    1.Create a rank column

    Rank = RANKX('Table',[Value],,DESC,Dense)

     

    2.Create the following table by entering data

     

    3.Create the following measure

    Measure =
    IF (
        MAX ( 'Table (2)'[Top N] ) = "Others",
        CALCULATE ( SUM ( 'Table'[Value] ), FILTER ( ALL ( 'Table' ), [Rank] > 5 ) ),
        CALCULATE (
            SUM ( 'Table'[Value] ),
            FILTER ( 'Table', [Rank] = VALUE ( MAX ( 'Table (2)'[Top N] ) ) )
        )
    )
    

    You can check more details from the attachment.

     

     

    Best Regards,

    Stephen Tao

     

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.