Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
chrisdavila
Frequent Visitor

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 revenue comes from top 20 clients,

 

HELP

 

What you see here is the totals row of the top 20

Capture.PNG

1 ACCEPTED SOLUTION
v-kkf-msft
Community Support
Community Support

Hi @chrisdavila ,

 

I created the sample data.

 

vkkfmsft_0-1652342296343.png

 

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 )

vkkfmsft_1-1652342350756.png

 

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.

View solution in original post

4 REPLIES 4
v-kkf-msft
Community Support
Community Support

Hi @chrisdavila ,

 

I created the sample data.

 

vkkfmsft_0-1652342296343.png

 

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 )

vkkfmsft_1-1652342350756.png

 

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.

lbendlin
Super User
Super User

This is standard DAX filter modification.  What have you tried so far and where are you stuck?

havent tried any yet so please some guidence

 

Please provide sanitized sample data that fully covers your issue. If you paste the data into a table in your post or use one of the file services it will be easier to assist you. Avoid posting screenshots of your source data if possible.

Please show the expected outcome based on the sample data you provided. Screenshots of the expected outcome are ok.

https://community.powerbi.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447523

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.