Forum Discussion

hill's avatar
hill
Helper I
5 years ago
Solved

Exclude specific values from top n

Hi all, I want to calculate the sales of top 5 companies as % of total, alll things worked well, but I found I have name "Others" as a company name. I want to exclude it from the top 5 companies, so...
  • amitchandak's avatar
    amitchandak
    5 years ago

    hill , Try to create a measure like this and rank/TOPN on that

     

    new sales =calculate([Sales], filter(data, data[companyname] <> "Others"))

  • mahoneypat's avatar
    5 years ago

    Please try this expression instead.

     

    Top 5 Concentration =
    DIVIDE (
        CALCULATE (
            [Sales],
            TOPN (
                5,
                FILTER (
                    VALUES ( data[companyname] ),
                    data[companyname] <> "Others"
                ),
                [Sales], DESC
            )
        ),
        CALCULATE (
            [Sales],
            ALLSELECTED ( data[companyname] )
        )
    )

     

    Regards,

    Pat