Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
rauldip22
Frequent 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 Amount.

 

My Table is:

GenderAmountCategoryCases
Male6768768A6
Male344B8
Male44442C6
Male3344D5
Female7656A4
Female44577B3
Female334442C6
Female455D5

 

Thanks!!!!

1 ACCEPTED SOLUTION

@rauldip22

 

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
)

View solution in original post

3 REPLIES 3
Zubair_Muhammad
Community Champion
Community Champion

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
)

@rauldip22

 

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!

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors
Top Kudoed Authors