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!Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now
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!
Check out the November 2025 Power BI update to learn about new features.
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!