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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
Absalon29
Helper III
Helper III

Capturing the last trading day of the previous year

I have a column of values for each month for each of the last 3 years (no blanks) and a separate date table.  I am trying to write a measure which captures the value on the last trading day of the previous year, which will dynamically update going forward so in 2018 the measure will give the last value date in Dec 2017. Could someone help me with the time intelligence snytax to do this?

1 ACCEPTED SOLUTION

4 REPLIES 4
Zubair_Muhammad
Community Champion
Community Champion

Hi @Absalon29

 

Try this pattern

 

Measure =
VAR LastTradingDay_LY =
    LASTDATE ( PREVIOUSYEAR ( VALUES ( TableName[Date] ) ) )
RETURN
    CALCULATE ( SUM ( TableName[Amount] ), CalendarTable[Date] = LastTradingDay_LY )

Regards
Zubair

Please try my custom visuals

Hi Zubair, 

 

I get a blank measure - here is the data I have been using https://1drv.ms/x/s!AiRs1BCuVWhM6EfOsWkw52AbDaq-

Hi @Absalon29

 

Please see the atached file

(with your sample data)

 

 


Regards
Zubair

Please try my custom visuals

Thanks very much, your input is invaluable and much appreciated. 

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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