Forum Discussion

Minakshi's avatar
Minakshi
Icon for Resolver I rankResolver I
6 years ago

topN DAX issue

Hello All,

I have input as shown in the following table. My expection is expected column in the table but getting is the final outcome.

getting = CALCULATE( SUMX(TOPN(2, table1, table1[score]),table1[plano]),

                 ALLEXCEPT(table1, table1[shop id],table1[visit id],table1[score])

 

shop idvisit iddatescoreplanoexpectedgetting
1115/07/20201122
128/07/20200.33022
131/07/20201122
2421/07/20200.67123
2515/07/20200.67123
267/07/20200.67123

 

Requirement:

I want to get top two values from plano column based on top two scores. In case when all the scores are same, it is giving me wrong answer (it is adding all 3). I sorted my columns in Query editor shop id, scores and visit date. I want the ouput of latest date if two dates having same score.

 

Can anyone help me with this.

Thanks

5 Replies