cancel
Showing results for
Did you mean:

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Helper I

## YTD LY Calculation not working

Hi,

I cannot figure out why my YTD LY calculation is not working.  Can someone take a look and help me?  I would expect to see the same value in August - December for the YTD Sale LY calculation but it is continuing to add values it should stop adding values in July.  I want to compare the same period this year compare to the same period last year.

Here are my calculations.

Total Sales = SUM(Data[Original Sales])
YTD Sales = TOTALYTD([Total Sales],'CALENDAR'[Date].[Date])
YTD Sales LY = TOTALYTD(SUM(Data[Original Sales]), DATEADD('CALENDAR'[Date],-1,year))

What am I doing wrong? Or is there a better YTD LY calculation I should use?
Thank you so much!

2 REPLIES 2
Super User

@kg4u , You have control that

examples

LYTD QTY forced=
var _max = date(year(today())-1,month(today()),day(today()))
return
//OR

LYTD QTY forced=
var _today = maxx(allselected('Order'),'order'[Date])
var _max = date(year(_today)-1,month(_today),day(_today))
return
//OR

comments // are an alternate formula for return

Helper I

I am trying to use your examples, which I am very thankful for.  However, they are giving me an error.

Announcements

#### Fabric certifications survey

Certification feedback opportunity for the community.

#### Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

#### Fabric Community Update - April 2024

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

Top Solution Authors
Top Kudoed Authors