I am using the AdventureWorks2016 database and I created a simple table showing all products with their total sales. The sales amount are correct.
The sales amount values come from a measure named [Sum of Internet Sales]. that looks like this:
Sum of Internet Sales =
SUM('Internet Sales'[Sales Amount])
There is a 1:M relationship between 'Product' and 'Internet Sales'.
In DAX Studio, I created the following query to get the top value:
SELECTCOLUMNS(
TOPN(
1,
'Product',
[Sum of Internet Sales],
DESC
),
"Product Name",
'Product'[Product Name]
)
The query returns Road-150 Red, 48
. This clearly isn't correct.
What's even more strange is if I change TOPN to return the top 2 values instead of 1, I get this:
Road-150 Red, 62
Road-150 Red, 48
Finally, if I change it to return the top 10, I get this:
Mountain-200 Silver, 46
Mountain-200 Silver, 38
Mountain-200 Black, 38
Road-150 Red, 44
Road-150 Red, 62
Mountain-200 Black, 46
Mountain-200 Black, 42
Road-150 Red, 52
Road-150 Red, 56
Road-150 Red, 48
I thought I understood TOPN until I ran into this. Or, perhaps my simple measure isn't correct?