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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Reply
N4gash
Frequent Visitor

Top N shows more rows than expected

Hi

 

I'm having troubles using Top N to show only the first 10 rows, I know that it works as expected and returns the first 10 values based on the measure. In my case it returns 18 rows.

 

My dataset is like this and i want to show only the first 10 rows:

N4gash_3-1679383785961.png

 

 

When I apply this filter...

N4gash_1-1679383716987.png

 

... it returns more than 10 rows:

 

N4gash_2-1679383754442.png

 

It's ok, it's the normal behaviour of the TOP because it's based on the measure sum_winners, but I only want the first 10 names.I've tried using RANX and TOPN without success, please, anyone has the key?

 

Thanks in advance,

Regards

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

Hi @N4gash ,

Please try below steps:
1. below is my test table

Table:
 

vbinbinyumsft_0-1679537144623.png

2. create measure with below dax formula

Sum_winners = SUM('Table'[Winners])
Measure =
VAR tmp =
    CALCULATETABLE (
        VALUES ( 'Table'[Name] ),
        TOPN ( 10, ALL ( 'Table' ), [Sum_winners], DESC )
    )
VAR _name =
    SELECTEDVALUE ( 'Table'[Name] )
RETURN
    IF ( _name IN tmp, 1 )

3. add a teable visual with fields and measure, add a measure to visual filter pane and apply

vbinbinyumsft_1-1679537355187.png

Please refer the attached .pbix file.

 

Best regards,
Community Support Team_Binbin Yu
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

2 REPLIES 2
Ashish_Mathur
Super User
Super User

Hi,

There's a tie.  Hence you see more than 10 rows.  If you want to see only 10 when there are ties, then which 10 do you want to see?


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
v-binbinyu-msft
Community Support
Community Support

Hi @N4gash ,

Please try below steps:
1. below is my test table

Table:
 

vbinbinyumsft_0-1679537144623.png

2. create measure with below dax formula

Sum_winners = SUM('Table'[Winners])
Measure =
VAR tmp =
    CALCULATETABLE (
        VALUES ( 'Table'[Name] ),
        TOPN ( 10, ALL ( 'Table' ), [Sum_winners], DESC )
    )
VAR _name =
    SELECTEDVALUE ( 'Table'[Name] )
RETURN
    IF ( _name IN tmp, 1 )

3. add a teable visual with fields and measure, add a measure to visual filter pane and apply

vbinbinyumsft_1-1679537355187.png

Please refer the attached .pbix file.

 

Best regards,
Community Support Team_Binbin Yu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
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.

Power BI Carousel June 2024

Power BI Monthly Update - June 2024

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

PBI_Carousel_NL_June

Fabric Community Update - June 2024

Get the latest Fabric updates from Build 2024, key Skills Challenge voucher deadlines, top blogs, forum posts, and product ideas.

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

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

Top Solution Authors