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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
Invisibleman
Helper II
Helper II

Need to get the highest selected month and year

Dear all,

 

For the report that I am creating, I have multiple charts. 1 should show only the value of the highest selected month & year, 1 should show the value of MTD, QTD or YTD, and 1 should show all values from start to the last date.

 

Now the MTD, QTD & YTD and all the astart to end is not an issue. But to get the values for only the selected year / month I don't get it to work.

 

I have 2 measures for the highest selected year and 1 for the highest selected month, which indeed are showing the correct value in the card. However, when I add those in the matrix, the highest selected month and the year, is not the actual highest selected month and the year. But the month and the year are basicly the year and month of the calendar, which are not the highest selected.

 

How can I make it so, that I am getting the actual highest selected year & month, so I can use those in the formula? The max isn't working and I also can't use the all or allselected.

 

As you can see in the sceenprint, in the matrix the highest selected month and year are not the same as in the card.

Examples.jpg

 

Please find here also the example power bi I have created; Test Power Bi 

 

Thanks in advance,

 

Regards,

Hans

1 ACCEPTED SOLUTION
johnt75
Super User
Super User

You can use

_Highest Month = CALCULATE( MAX(mapCalendar[Month]), ALLSELECTED(MapCalendar) )

_Highest Selected Year = CALCULATE( MAX(mapcalendar[year]), ALLSELECTED(MapCalendar) )

View solution in original post

2 REPLIES 2
johnt75
Super User
Super User

You can use

_Highest Month = CALCULATE( MAX(mapCalendar[Month]), ALLSELECTED(MapCalendar) )

_Highest Selected Year = CALCULATE( MAX(mapcalendar[year]), ALLSELECTED(MapCalendar) )

Hello Johnt75,

 

Thank you very much, I was suffering for days to get this done. And I did use the max and did try with the allselected, but I didn't think about using the calculate, which surely does make sense.

 

Thanks again for the help, very appreciated.

 

Regards,

Hans

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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