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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

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
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel1

Power BI Monthly Update - May 2024

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

Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.