Forum Discussion
rauldip22
8 years agoFrequent Visitor
How to select a top filtered value from a table with DAX
Hello! I need a DAX consult to select a Gender with the max Amount from my table filtered by a Category. With SQL ir should be: SELECT TOP 1 Gender FROM TableName WHERE Category = "A" ORDER BY Amou...
- 8 years ago
Or you can hardcode it for Category A as follows
Measure 2 = TOPN ( 1, VALUES ( TableName[Gender] ), CALCULATE ( SUM ( TableName[Amount] ), TableName[Category] = "A" ), DESC )
Zubair_Muhammad
Community Champion
8 years agoHi rauldip22
Try this MEASURE...It will give you the Gender with Highest Amount according to category or cases that you select
Measure =
TOPN (
1,
VALUES ( TableName[Gender] ),
CALCULATE ( SUM ( TableName[Amount] ) ), DESC
)Zubair_Muhammad
Community Champion
8 years ago
Or you can hardcode it for Category A as follows
Measure 2 =
TOPN (
1,
VALUES ( TableName[Gender] ),
CALCULATE ( SUM ( TableName[Amount] ), TableName[Category] = "A" ), DESC
)- rauldip228 years agoFrequent Visitor
Thanks!!! It Works!