0
votes

I am creating a report in which there is one table which should shows top 3 Employee Names and there respective sale amounts based on there Sales Amount.

When TOPN is used alone, I get correct output in form of new table. But its without sale Amount. However when TOPN is used along with CALCULATE function, I get all the Employee Names, which is incorrect

DAX query that works well but has only one column:

TOPN(3,values(Sale[Employee Name]),CALCULATE(sum(Sale[Total Excluding Tax])))

DAX Measure which is not filtering the top 3 rows :

TopN = CALCULATE(SUM(Sale[Total Excluding Tax]),TOPN(3,values(Sale[Employee Name]),CALCULATE(sum(Sale[Total Excluding Tax]))))

Where am I going wrong, please let me know. Screenshot of both the queries is as follows:

enter image description here

enter image description here

1

1 Answers

1
votes

since your first DAX query is working:

TOPN(3,values(Sale[Employee Name]),CALCULATE(sum(Sale[Total Excluding Tax])))

How about just creating a simple SUM-measure and adding it as another column, next to the TOPN?

Sum sales = SUM(Sale[Total Excluding Tax])

It should work, since your TOPN is calculating correctly. Or am I misunderstanding the question?