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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
Redraidas1
Helper I
Helper I

How to get TOP10

I'm trying to limit my DAX top give me the the SUM of TOP10 sales, however, DAX seems to be ignoring my TOP10 request and won't limit the caluclation to TOP 10 only. Any ideas? Thanks!
 
CALCULATE (
SUM ( AfterSales_BM[ABCValue] ),
TOPN( 10, AfterSales_BM, AfterSales_BM[ABCValue]),
FILTER (
Config,
Config[FieldCode] = "1"
  )
)
1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Redraidas1 ,

 

You could consider to create a measure using RANKX() function.

Then add this measure to filter to filter the data that rank value is less than 10.

For example:

_sum = SUM('Table'[value])

_rank = RANKX(ALL('Table'),[_sum])

4.PNG 

 

Best Regards,

Jay

View solution in original post

5 REPLIES 5
Anonymous
Not applicable

Hi @Redraidas1 ,

 

You could consider to create a measure using RANKX() function.

Then add this measure to filter to filter the data that rank value is less than 10.

For example:

_sum = SUM('Table'[value])

_rank = RANKX(ALL('Table'),[_sum])

4.PNG 

 

Best Regards,

Jay

parry2k
Super User
Super User

@Redraidas1 it is not as straightforward as it looks like, you are doing top 10 on a table and also filtering on another table. Also what are your expectation when you are seeing the data below, let's say we want the top 3 (would you like to see (200 + 40 + 30, = 270 since these are top 3 values ), or you want it to sum by the customer and then take top 3 in that case from the data below the result will be (A = 15, B = 30, C = 200, D = 70 and top 3 will be then 200 + 70 + 30 = 300)

 

A - 10

A - 5

B - 20

B - 10

C - 200

D - 30

D - 40

 

It will be easier if you share pbix file using one drive/google drive with the expected output. Remove any sensitive information before sharing.



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

VijayP
Super User
Super User

@Redraidas1 

Use this Function
VAR = RankofABC = Rankx(all(AfterSales_BM[ColumnName]),sum(abcvalue))
return
calculate(sum(abcvalue),filter(all(all(AfterSales_BM[ColumnName]),RankofABC<=10),distinct(columname))




Did I answer your question? Mark my post as a solution! Appreciate your Kudos!!
MY Blog || My YouTube Channel || Connect with me on Linkedin || My Latest Data Story - Ageing Analysis

Proud to be a Super User!


VijayP
Super User
Super User

@Redraidas1 

CALCULATE (
SUM ( AfterSales_BM[ABCValue] ),
TOPN( 10, AfterSales_BM, AfterSales_BM[ABCValue]),
FILTER (
Config,
Config[FieldCode] = "1"
  ),Distinct(ColumnName)
)
The bold one is which column you want to see the Rank (most probably AferSales_BM)?!
Please do let me know whether this helped!
 



Did I answer your question? Mark my post as a solution! Appreciate your Kudos!!
MY Blog || My YouTube Channel || Connect with me on Linkedin || My Latest Data Story - Ageing Analysis

Proud to be a Super User!


I changed it, but the problem is still there.

DAX:

CALCULATE (
 
SUM ( AfterSales_BM[ABCValue] ),
TOPN( 5, AfterSales_BM, AfterSales_BM[ABCValue]),
FILTER (
Dim_Report_Config,
Dim_Report_Config[FieldCode] = "1"
), DISTINCT(AfterSales_BM[ABCValue])
)

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors
Top Kudoed Authors