Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.
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 Amount.
My Table is:
Gender | Amount | Category | Cases |
Male | 6768768 | A | 6 |
Male | 344 | B | 8 |
Male | 44442 | C | 6 |
Male | 3344 | D | 5 |
Female | 7656 | A | 4 |
Female | 44577 | B | 3 |
Female | 334442 | C | 6 |
Female | 455 | D | 5 |
Thanks!!!!
Solved! Go to Solution.
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 )
Hi @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 )
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 )
Thanks!!! It Works!
Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!
Check out the September 2025 Power BI update to learn about new features.