Forum Discussion

Peter_Yaacoub's avatar
Peter_Yaacoub
Frequent Visitor
3 years ago
Solved

TOP N excluding specific values

  Top 10 Growth % = VAR _rankingContext = VALUES ( Companies[Company] ) RETURN CALCULATE ( [Net Sales Growth %], TOPN ( 10, ALL ( Companies[Company] ), [Net Sales Growth %]...
  • Anonymous's avatar
    Anonymous
    3 years ago

    Hi Peter_Yaacoub ,

    Please try to update the formula of the measure [] as below and check if it can return your expected result... You can find the details in the attachment.

    Top 10 Growth % = 
    VAR _selcompany =
        SELECTEDVALUE ( 'Companies'[Company] )
    VAR _rank =
        RANKX (
            FILTER (
                ALLSELECTED ( 'Companies'[Company] ),
                NOT Companies[Company] IN { "Company A", "Company B" }
            ),
            [Net Sales Growth %]
        )
    RETURN
        IF (
            NOT _selcompany
                IN { "Company A", "Company B" }
                && _rank <= 10,
            [Net Sales Growth %],
            BLANK ()
        )

    If the above one can't help you, please provide some raw data in your table (exclude sensitive data) with Text format and your expected result with backend logic and special examples? It would be helpful to find out the solution. You can refer the following links to share the required info:

    How to provide sample data in the Power BI Forum

    How to Get Your Question Answered Quickly

    And It is better if you can share a simplified pbix file. You can refer the following link to upload the file to the community. Thank you.

    How to upload PBI in Community

    Best Regards