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
bjoshi
Resolver I
Resolver I

Total amount for Top N

Hi,

 

I have two measures: 

Total Revenue = Sum(DSS[Revenue])

RankDebtors = RANKX(All(DSS[Debtors]),[Total Revenue])

 

Now, I need another measure which gives me the Total Revenue for Top 10 Debtors. I have tried few formulas including this:

RevenueTop10Debtors = CALCULATE(SUM(DSS[Revenue]), FILTER(DSS,[RankDebtors]<=10)).

 

But, I couldn't get it to work. What should the measure be written?

 

 

 

1 ACCEPTED SOLUTION
Sean
Community Champion
Community Champion

@bjoshi  How about this?

 

RevenueTop10Debtors =
CALCULATE (
    [Total Revenue],
    TOPN ( 10, ALL ( DSS[Debtors] ), [RankDebtors], ASC )
)

HTH! Smiley Happy

 

BTW try this also you were almost there...

RevenueTop10Debtors =
CALCULATE (
    [Total Revenue],
    FILTER ( ALL ( DSS[Debtors] ), [RankDebtors] <= 10 )
)

Both these Measures should give you the same result! Smiley Happy

View solution in original post

1 REPLY 1
Sean
Community Champion
Community Champion

@bjoshi  How about this?

 

RevenueTop10Debtors =
CALCULATE (
    [Total Revenue],
    TOPN ( 10, ALL ( DSS[Debtors] ), [RankDebtors], ASC )
)

HTH! Smiley Happy

 

BTW try this also you were almost there...

RevenueTop10Debtors =
CALCULATE (
    [Total Revenue],
    FILTER ( ALL ( DSS[Debtors] ), [RankDebtors] <= 10 )
)

Both these Measures should give you the same result! Smiley Happy

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.