Forum Discussion

_chris_'s avatar
_chris_
Icon for Helper III rankHelper III
7 years ago
Solved

Help with TopN Dax expression needed

Hi, I have the following visual table:

 

 

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

  • Write a measure like this:

     

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

    Use this as the Value for your Top N filter.

3 Replies

  • Greg_Deckler's avatar
    Greg_Deckler
    Icon for Community Champion rankCommunity Champion

    Write a measure like this:

     

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

    Use this as the Value for your Top N filter.

    • _chris_'s avatar
      _chris_
      Icon for Helper III rankHelper III

      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?

  • v-piga-msft's avatar
    v-piga-msft
    Icon for Resident Rockstar rankResident Rockstar

    Hi _chris_,

     

    Hi _chris_,

     

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

     

     

     

     

     

     

    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