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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

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
)

Regards
Zubair

Please try my custom visuals

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
)

Regards
Zubair

Please try my custom visuals

@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
)

Regards
Zubair

Please try my custom visuals

Thanks!!! It Works!

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel1

Power BI Monthly Update - May 2024

Check out the May 2024 Power BI update to learn about new features.