Forum Discussion

SpartanGhost's avatar
SpartanGhost
New Member
3 years ago

TOPN Max Sales Duplication

Hello, 


Hoping you could possibly help, I'm having an issue with the below DAX as there are duplicates in the dataset, so TOPN wont run and the visual fails as "A table of multiple values was supplied where a single value was expected". 

 

I want to receive the name of the MAX salesperson but in one scenario 2 salespersons have sold 9 then the visual fails. 

 

Yet, any other filter applied where there are unique sales values the visual works fine and is able to calculate the MAX salesperson.

 

 

highestRecordedName =
TOPN(
    1,
    VALUES(Sales[Sales Person]),
    CALCULATE(SUM(Sales[Total Sales]))
)
 
 
 
Thanks in advance!

 

1 Reply

  • Add a small random number to the sum of sales for each rep to break the ties.