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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
mbosch
Regular Visitor

How to calculate TOPN

Hello.

 

I have the following table:

 

CycleID, UserNAme,CustomerID, score. 

I want to create a formula that sums the top 10 scores within cycleid,username. Any suggestion? I have been trying TOPN but it doesnt work.

 

Thank you

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

Hi @mbosch 

 

Is this what you want (I take top 2 as an example)? If not, can you please provide some dummy data and expected result that we can work with? 

Measure = SUMX(TOPN(2, 'Table', 'Table'[Score], DESC), 'Table'[Score])

vjingzhanmsft_0-1707288202332.png

 

Best Regards,
Jing
If this post helps, please Accept it as Solution to help other members find it. Appreciate your Kudos!

View solution in original post

3 REPLIES 3
v-jingzhan-msft
Community Support
Community Support

Hi @mbosch 

 

Is this what you want (I take top 2 as an example)? If not, can you please provide some dummy data and expected result that we can work with? 

Measure = SUMX(TOPN(2, 'Table', 'Table'[Score], DESC), 'Table'[Score])

vjingzhanmsft_0-1707288202332.png

 

Best Regards,
Jing
If this post helps, please Accept it as Solution to help other members find it. Appreciate your Kudos!

mbosch
Regular Visitor

Hello.

 

It doesnt work. It is not summing the top 10. Any alternative?

bhanu_gautam
Super User
Super User

@mbosch , Try using below mentioned method 

 

Top10ScoreSum =
CALCULATE (
SUM ( 'YourTableName'[score] ),
TOPN (
10,
'YourTableName',
'YourTableName'[score],
DESC,
'YourTableName'[CycleID],
'YourTableName'[UserName]
)
)

 

Please accept as solution and give kudos if it helps




Did I answer your question? Mark my post as a solution! And Kudos are appreciated

Proud to be a Super User!




LinkedIn






Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.