Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago
Solved

Top 20 Percentage

Hi all!   Completing a finance report where i have a list of top 20 clients and the totals - but now i want to see how it compares t to the full table so in this case - what percentage of net reven...
  • v-kkf-msft's avatar
    4 years ago

    Hi Anonymous ,

     

    I created the sample data.

     

     

    Then use these measures to calculate top n values.

     

    RankClients = 
    RANKX (
        ALLSELECTED ( 'Table'[clients] ),
        CALCULATE ( SUM ( 'Table'[amount] ) ),
        ,
        DESC,
        SKIP
    )
    Top N Percentage = 
    VAR N = 3
    VAR totalamount =
        SUMX ( ALL ( 'Table' ), 'Table'[amount] )
    VAR TopNTotal =
        CALCULATE (
            SUM ( 'Table'[amount] ),
            FILTER ( ALLSELECTED ( 'Table'[clients] ), [RankClients] <= N )
        )
    RETURN
        DIVIDE ( TopNTotal, totalamount )

     

    If the problem is still not resolved, please provide detailed error information or the expected result you expect. Let me know immediately, looking forward to your reply.
    Best Regards,
    Winniz
    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.