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
forrestcrowson
Frequent Visitor

TopN filter returning more than N requested

I am using the TopN filter and when I do I do it returns more than the N i requested.  I used top 10 agents by conversion but it returned almost 30 agents.  Does conversioni= infinity or NaN have anything to with it?  If I take those out I still get more than ten agetns listed. All help is apprecitated.

 

 

2 REPLIES 2
v-sihou-msft
Employee
Employee

@forrestcrowson

 

In DAX, when using TOPN() function, it returns top N rows based on the order_by_expression. However if the order_by_expression has same values, those rows will be retrieved. That's the reason why you get more than 10 agents.

 

Regards,

It's giving you everyone that's tied for the same spot. I think that's what @v-sihou-msft is saying too but I'm not sure. Anyway topn returns the matches for the top n scores, not the first n matches it finds. So imagine you want the top 10 people, but 3 people are tied for number 1, 7 are tied for number 2, and there's only 1 each for 3rd place through 10th place. TOPN will give you 18 people, not 10. If you only want 10, you need to come up with a way to calculate a tie-breaker that will force each person to have a unique score.





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




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.