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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Anonymous
Not applicable

DAX expression

Hi,

 

I have data in the following format:

karthikbv4_0-1649671632931.png

I need to find the max of month in each year, the expected output is like this:

Year            Month max

2019           12

2020            5

 

How can i achieve this in DAX? Thank you

 

1 ACCEPTED SOLUTION
Adescrit
Impactful Individual
Impactful Individual

Hi @Anonymous ,

 

You can create it as a measure like this:

 

Max Month in Year Measure = 
    CALCULATE( MAX('Date'[Month]),'Date'[Year] = SELECTEDVALUE('Date'[Year]))

 

Or you can create a column like this:

 

Max Month in Year = 
    CALCULATE( MAX('Date'[Month]), FILTER('Date', 'Date'[Year] = EARLIER('Date'[Year]) ))

Did I answer your question? Mark my post as a solution!
My LinkedIn

View solution in original post

4 REPLIES 4
Adescrit
Impactful Individual
Impactful Individual

Hi @Anonymous ,

 

You can create it as a measure like this:

 

Max Month in Year Measure = 
    CALCULATE( MAX('Date'[Month]),'Date'[Year] = SELECTEDVALUE('Date'[Year]))

 

Or you can create a column like this:

 

Max Month in Year = 
    CALCULATE( MAX('Date'[Month]), FILTER('Date', 'Date'[Year] = EARLIER('Date'[Year]) ))

Did I answer your question? Mark my post as a solution!
My LinkedIn
Anonymous
Not applicable

Hi Adescrit

 

Thanks for your solution. Appreciate it.

Samarth_18
Community Champion
Community Champion

Hi @Anonymous ,

 

You can drag your year column and month column then mark your month column summerized as Max

Samarth_18_0-1649672020216.png

 

or create a measure like below:-

 

measure=max(table[month])

 

 

Thanks,

Samarth

 

 

Best Regards,
Samarth

If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!
Connect on Linkedin

Anonymous
Not applicable

Thanks for responding if I have tried creating a measure like this:

measure=max(table[month])

 But the problem is, it needs to calculate that for each year. The above method just displays 12 for both the years. I need to calculate the above using DAX expression. 

 

 

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.