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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
Bobbys
Helper III
Helper III

YTD-1

Hello.

I'm having difficulties visualising my YTD for this year and YTD for last year measures.

Bobbys_0-1633677412445.png

As you can see from the chart, the YTD-1 goes on until dec 31st, however, I want it to end at the same time as the YTD line. The YTD line stops at the last date with sales numbers. 
The DAX I've used for YTD is :

YTD = var _lastActualValue = MAX(Sheet1[Date])
RETURN
IF(SELECTEDVALUE(Dates[Date])<=_lastActualValue,
CALCULATE(SUM(Sheet1[Verdi]),DATESYTD(Dates[Date]))
)

And for YTD -1 I've used: 
YTD -1 = CALCULATE([YTD],SAMEPERIODLASTYEAR(Dates[Date]))
 
In a table, the output looks like this:
Bobbys_1-1633677577502.png 
Please, any assistance is well appreciated!

 

3 REPLIES 3
VahidDM
Super User
Super User

Hi @Bobbys 

 

Try this:

 

YTD -1 = CALCULATE([YTD],SAMEPERIODLASTYEAR(Dates[Date]),Dates[Date]<=MAX(Sheet1[Date]))
 
Output=
VahidDM_0-1633856220231.png

 

 

My data:

VahidDM_1-1633856262769.png

 

 

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

Appreciate your Kudos!!


Hello @VahidDM. Thanks for the tip, however, I'm still unable to make it work.

Here's how it looks: 

Bobbys_0-1633860168732.png


I have no idea where it's going wrong and it's really frustrating. 

 

Hi @Bobbys 

 

Is there any relation between your Date and Value tables? Can you share a sample of your data or share your PBIX file? [after removing sensetive data]

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

Appreciate your Kudos!!



Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

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.