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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
PDTV
Frequent Visitor

Dax YTD with Calendar in format YYYYMM

I have write a YTD measure and it works fine if my columns are Year, Month. However, it doesn't work if I want to use the column yyyymm. Please help me fix it.

Thank you so much

PDTV_0-1729250439761.png

 

1 ACCEPTED SOLUTION
Kedar_Pande
Super User
Super User

For the yyyymm format (Yr_M), you can use a modified approach by transforming the Yr_M values into proper date formats:

SO Amt YTD_FF = 
CALCULATE(
SUM('Table'[SO Amt]),
FILTER(
ALL('Table'),
'Table'[Yr_M] <= MAX('Table'[Yr_M]) &&
YEAR(DATE(LEFT('Table'[Yr_M], 4), MID('Table'[Yr_M], 5, 2), 1)) = YEAR(TODAY())
)
)

💌 If this helped, a Kudos 👍 or Solution mark would be great! 🎉
Cheers,
Kedar
Connect on LinkedIn

View solution in original post

3 REPLIES 3
Ashish_Mathur
Super User
Super User

Hi,

If the YYMMM column is from the Calendar Table, then try this

Measure = calculate([Sales],datesytd(calendar[date],"31/12")))

Hope this helps.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
Kedar_Pande
Super User
Super User

For the yyyymm format (Yr_M), you can use a modified approach by transforming the Yr_M values into proper date formats:

SO Amt YTD_FF = 
CALCULATE(
SUM('Table'[SO Amt]),
FILTER(
ALL('Table'),
'Table'[Yr_M] <= MAX('Table'[Yr_M]) &&
YEAR(DATE(LEFT('Table'[Yr_M], 4), MID('Table'[Yr_M], 5, 2), 1)) = YEAR(TODAY())
)
)

💌 If this helped, a Kudos 👍 or Solution mark would be great! 🎉
Cheers,
Kedar
Connect on LinkedIn

Thank you so much! It works perfectly now.

I would like to ask if I don't want Year (Today), how can I change it?

PDTV_0-1729480415595.png

 

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! Prices go up Feb. 11th.

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

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