Forum Discussion

pkumar's avatar
pkumar
Frequent Visitor
9 years ago
Solved

Top 5 and everything else other

 

My pie chart shows the percentage of each job title based on count. I only want to show the top 5 though, and I want everything else to be show in something called "Other". I want this to be dynamic, meaning the top 5 could change if I uploaded new data.

  • pkumar

    AFAIK, it is not supported in a visual setting, but you can create a calculated column as a workaround.

     

    category_ =
    IF (
        CONTAINS (
            TOPN (
                3,
                SUMMARIZE ( 'table', 'table'[category], "cnt"COUNTA ( 'table'[category] ) ),
                [cnt], DESC
            ),
            'table'[category], 'table'[category]
        ),
        'table'[category],
        "other"
    )

2 Replies

  • Eric_Zhang's avatar
    Eric_Zhang
    Microsoft Employee

    pkumar

    AFAIK, it is not supported in a visual setting, but you can create a calculated column as a workaround.

     

    category_ =
    IF (
        CONTAINS (
            TOPN (
                3,
                SUMMARIZE ( 'table', 'table'[category], "cnt"COUNTA ( 'table'[category] ) ),
                [cnt], DESC
            ),
            'table'[category], 'table'[category]
        ),
        'table'[category],
        "other"
    )