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

The Power BI DataViz World Championships are on! With four chances to enter, you could win a spot in the LIVE Grand Finale in Las Vegas. Show off your skills.

Reply
Anonymous
Not applicable

Need Max value month wise from last 2 years selected from the slicer

Hi All,

 

I want maximum Value in each month from last 2 year comparison. Kindly help me if data is like below 

bhuprakash_0-1709015826687.png

 

2 ACCEPTED SOLUTIONS
Daniel29195
Super User
Super User

@Anonymous 

write the following measure : 

(this will take into consideration current year and previous year ) 

m = 

var currentyear = year ( today() )

var ds = 

filter ( 

tbl_name ,  year >= currentyear -  1 )

RETURN

maxx( ds , value ) 

 

NB: if you want to take only prev 2 years excluding the current year,  change the filter to this : 

var ds = 

filter ( 

tbl_name ,  year >= currentyear -  2 && year < currentyear )

 

 

tbl_name being the table containing your data, and value being the column name with the values you want to display .

 

 

hope this helps .

 

 

If my answer helped sort things out for you, i would appreciate a thumbs up 👍 and mark it as the solution
It makes a difference and might help someone else too. Thanks for spreading the good vibes! 🤠

View solution in original post

Kishore_KVN
Super User
Super User

Hello @Anonymous please create below measure

Max Value = CALCULATE(MAXX('Table','Table'[Value]),ALLEXCEPT('Table','Table'[Month]))

Kishore_KVN_0-1709017354902.png

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

 

View solution in original post

4 REPLIES 4
Anonymous
Not applicable

hank kyou so much @Kishore_KVN  for the help

Kishore_KVN
Super User
Super User

Hello @Anonymous please create below measure

Max Value = CALCULATE(MAXX('Table','Table'[Value]),ALLEXCEPT('Table','Table'[Month]))

Kishore_KVN_0-1709017354902.png

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

 

Daniel29195
Super User
Super User

@Anonymous 

write the following measure : 

(this will take into consideration current year and previous year ) 

m = 

var currentyear = year ( today() )

var ds = 

filter ( 

tbl_name ,  year >= currentyear -  1 )

RETURN

maxx( ds , value ) 

 

NB: if you want to take only prev 2 years excluding the current year,  change the filter to this : 

var ds = 

filter ( 

tbl_name ,  year >= currentyear -  2 && year < currentyear )

 

 

tbl_name being the table containing your data, and value being the column name with the values you want to display .

 

 

hope this helps .

 

 

If my answer helped sort things out for you, i would appreciate a thumbs up 👍 and mark it as the solution
It makes a difference and might help someone else too. Thanks for spreading the good vibes! 🤠

Anonymous
Not applicable

thanks @Daniel29195 , it also working for me.

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

FebPBI_Carousel

Power BI Monthly Update - February 2025

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

Feb2025 NL Carousel

Fabric Community Update - February 2025

Find out what's new and trending in the Fabric community.