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

Vote for your favorite vizzies from the Power BI Dataviz World Championship submissions. Vote now!

Reply
Anonymous
Not applicable

To get year corresponding to maximum sales

I want to get the year corresponding to maximum sales. See data below

Input: 

Kanishka001_0-1644941583871.png

Expected Output:

Kanishka001_1-1644941706412.png

Help me with a DAX to get the result

1 ACCEPTED SOLUTION
goncalogeraldes
Super User
Super User

Hello there @Anonymous ! Check if this works for you:

 

Max Sales Year =
CALCULATE (
    SELECTEDVALUE ( 'Your_Table'[Year] ),
    FILTER ( 'Your_Table', [Sales] = MAX ( [Sales] ) )
)

 

For max sales you can use:

 

Max Sales =
 MAX ( 'Your_Table'[Sales] ) 

 

Hope this answer solves your problem!
If you need any additional help please @ me in your reply.
If my reply provided you with a solution, please consider marking it as a solution ✔️ or giving it a kudoe 👍
Thanks!

You can also check out my LinkedIn!

Best regards,
Gonçalo Geraldes

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

Hi @Anonymous ,

 

I suggest you to create a rank measure, then add this measure into visual level filter and set it to show items when value =1.

Rank =
RANKX (
    FILTER ( ALL ( 'Table' ), 'Table'[Category] = MAX ( 'Table'[Category] ) ),
    CALCULATE ( SUM ( 'Table'[Sales] ) ),
    ,
    DESC,
    DENSE
)

Result is as below.

1.png

Best Regards,
Rico Zhou

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

goncalogeraldes
Super User
Super User

Hello there @Anonymous ! Check if this works for you:

 

Max Sales Year =
CALCULATE (
    SELECTEDVALUE ( 'Your_Table'[Year] ),
    FILTER ( 'Your_Table', [Sales] = MAX ( [Sales] ) )
)

 

For max sales you can use:

 

Max Sales =
 MAX ( 'Your_Table'[Sales] ) 

 

Hope this answer solves your problem!
If you need any additional help please @ me in your reply.
If my reply provided you with a solution, please consider marking it as a solution ✔️ or giving it a kudoe 👍
Thanks!

You can also check out my LinkedIn!

Best regards,
Gonçalo Geraldes

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

Vote for your favorite vizzies from the Power BI World Championship submissions!

Sticker Challenge 2026 Carousel

Join our Community Sticker Challenge 2026

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

January Power BI Update Carousel

Power BI Monthly Update - January 2026

Check out the January 2026 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.