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
_chris_
Helper II
Helper II

Help with TopN Dax expression needed

Hi, I have the following visual table:

 

image.png

 

Amount is already an aggregation (table has 8 rows in total). I want to only show the Top 2 Ids where the amount is larger than 10. Thus, Ids 4 and 2 should be shown.

 

I tried to achieve this through visual filters but did not get it done. I can filter for Top 2 and it shows 4+3 but when I add the >10 criteria it only shows 4 instead od 4+2.

 

So I was thinking of creating a measure but do not know how.

 

Your help would be great.

 

Thx, Chris

1 ACCEPTED SOLUTION
Greg_Deckler
Super User
Super User

Write a measure like this:

 

Measure = IF(SUM([amount])>10,MAX([id]),BLANK())

Use this as the Value for your Top N filter.


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

View solution in original post

3 REPLIES 3
v-piga-msft
Resident Rockstar
Resident Rockstar

Hi @_chris_,

 

Hi @_chris_,

 

By my test the solution of Greg_Deckler should solve your problem.

 

test result.png

 

 

 

 

 

Have you solved your problem?

 

If you have solved, please accept the replies making sense as solution to your question so that people who may have the same question can get the solution directly.

 

If you still need help, please share your data sample and your desired output so that we could help further on it.

 

Best Regards,

Cherry

Community Support Team _ Cherry Gao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Greg_Deckler
Super User
Super User

Write a measure like this:

 

Measure = IF(SUM([amount])>10,MAX([id]),BLANK())

Use this as the Value for your Top N filter.


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

Thanks Greg, that is exactly what I was looking for. However, one side question. Would it also be possible to do the whole Top N stuff also in the measure?

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.