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
FR14
Helper I
Helper I

LY YTD Measure

Hello Everyone,

 

This is my measure for LY YTD but it shows complete year values, how can i modify it to show the last year year to date values?

 

LY YTD Bookings Annualized =
  VAR __MaxDate = MAX('Transaction Date'[Date])
RETURN
Calculate(SUM(Orders[Annualized Value]), YEAR('Transaction Date'[Date]) = YEAR(__MaxDate)-1, MONTH('Transaction Date'[Date]) <= MONTH(__MaxDate ))
10 REPLIES 10
saurabhtd
Resolver II
Resolver II

@FR14  If your there is date table in the model, you can use time intelliegence functions like DATEADD , SAMEPERIODLASTYEAR  for LY YTD calculations.  

saurabhtd
Resolver II
Resolver II

@FR14 You can modify the logic this way. This will give LY YTD values. 

LY YTD Bookings Annualized = 
VAR __MaxDate = MAX('Transaction Date'[Date])
VAR __StartDateLastYear = DATE(YEAR(__MaxDate)-1, MONTH(__MaxDate), DAY(__MaxDate))
RETURN
CALCULATE(
    SUM(Orders[Annualized Value]),
    'Transaction Date'[Date] >= __StartDateLastYear && 'Transaction Date'[Date] <= __MaxDate
)

 

Thank you for your support, this solution did not solve my problem. It works okay for this YTD but when i select other months and years values don't change

@FR14 You can try this

LY YTD Bookings Annualized = 
VAR __MaxDate = MAX('Transaction Date'[Date])
VAR __StartDateLastYear = DATE(YEAR(__MaxDate)-1, 01, 01)
VAR __Enddate = DATE(YEAR(__MaxDate)-1,MONTH(__MaxDate), DAY(__MaxDate))
RETURN
CALCULATE(
    SUM(Orders[Annualized Value]),
    'Transaction Date'[Date] >= __StartDateLastYear && 'Transaction Date'[Date] <= __Enddate
)

Thank you i checked this one and it shows complete last year values not last year January.

@FR14 Did you got what you where looking ?

Not really, it still shows complete last year data not last year January.

@FR14 You can try this, this will give for last year january to date 

LY YTD Bookings Annualized = 
VAR __MaxDate = MAX('Transaction Date'[Date])
VAR __StartDateLastYear = DATE(YEAR(__MaxDate)-1, 01, 01)
VAR __Enddate = DATE(YEAR(__MaxDate)-1, 01, DAY(__MaxDate))
RETURN
CALCULATE(
    SUM(Orders[Annualized Value]),
    'Transaction Date'[Date] >= __StartDateLastYear && 'Transaction Date'[Date] <= __Enddate
)

 

Thank you very much but result show me this year values when i implement it.

@FR14  You can try this

LY YTD Bookings Annualized = 
VAR __MaxDate = MAX('Transaction Date'[Date])
VAR __StartDateLastYear = DATE(YEAR(__MaxDate)-1, 01, 01)
RETURN
CALCULATE(
    SUM(Orders[Annualized Value]),
    'Transaction Date'[Date] >= __StartDateLastYear && 'Transaction Date'[Date] <= __MaxDate
)

 

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!

November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

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.