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
miriammmattar
Frequent Visitor

Title with selected YTD latest Month

Hi,

I have a table of 3 columns: Month, Value and Date

I wanted to create an interactive title using the selected Month from a slicer, so to show a specific Month if only one month is selected or the latest month if multiple months are selected.

I tried the following but the YTD doesn't go to the latest Month, although the column Month is sorted by the date column:

Title = IF(SELECTEDVALUE('table'[Date]), "Sales MTD" & " " & SELECTEDVALUE('Table'[Month]) ,"Sales YTD" & " " & max('Table'[Month]))
miriammmattar_0-1643175705013.png

Thanks in advance

1 ACCEPTED SOLUTION

@miriammmattar 

You can force the month with this:

Latest month =
var _rank = CALCULATE(MAX('Calendar'[Month]),ALLSELECTED('Calendar'[MonthName])) return
CONCATENATE(calculate(MAX('Calendar'[MonthName]),ALL('Calendar'),'Calendar'[Month]=_rank)," YTD")
 
This way it will always return the month whose monthnum is the highest.

ValtteriN_0-1643187580223.png

 





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

Proud to be a Super User!




View solution in original post

6 REPLIES 6
ValtteriN
Super User
Super User

Hi,

Could you show what your measure is returning? When I tried to re-create the issue I got the desired value without any issues.

ValtteriN_0-1643180250666.png



Latest month = CONCATENATE(MAX('Calendar'[Month])," YTD")




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

Proud to be a Super User!




Thanks @ValtteriN for your reply, if i put date or numbers like u did it comes correct but if i put months short name i get this

miriammmattar_0-1643181539513.png

 

Hi,

In that case this might work:
1. Sort your monthname by monthnum:

 

ValtteriN_4-1643184174873.png

 

 


2. use calendar table instead of Table for the values

3. This DAX worked for me:

Latest month = CONCATENATE(MIN('Calendar'[MonthName])," YTD")
ValtteriN_3-1643184149297.png

 

 

 







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

Proud to be a Super User!




@ValtteriN Just tried that I think the logic goes as per the first alphabet only, I selected Sep, Oct and Nov and yest it showed Nov but if you select as well Jul & Aug it shows Aug insteda of Nov, can you try your end selecting those months as well and let me know if it still works? thanks

 

@miriammmattar 

You can force the month with this:

Latest month =
var _rank = CALCULATE(MAX('Calendar'[Month]),ALLSELECTED('Calendar'[MonthName])) return
CONCATENATE(calculate(MAX('Calendar'[MonthName]),ALL('Calendar'),'Calendar'[Month]=_rank)," YTD")
 
This way it will always return the month whose monthnum is the highest.

ValtteriN_0-1643187580223.png

 





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

Proud to be a Super User!




@ValtteriN great!!! that worked 🙂

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.