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
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
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.