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

Get Fabric certified for FREE! Don't miss your chance! Learn more

Reply
Anonymous
Not applicable

SAMEPERIODLASTYEAR

Hi there,
 
I'm using the formula below to get last year's value:
 

 

Yield-1Y = CALCULATE(SUM('US Treasury'[Yield]),DATEADD('US Treasury'[Date],-1,YEAR))
or
Yield-1Y = CALCULATE(SUM('US Treasury'[Yield]),SAMEPERIODLASTYEAR('US Treasury'[Date]))

 

How can I ask it to get the latest available data before last year if last year appears to have blank data eg its a holiday or weekend?

 

3 REPLIES 3
v-angzheng-msft
Community Support
Community Support

Hi, @Anonymous 

 

Getting the data for the same period last year is not difficult to implement, but if additional judgments are needed for working days, more complex logic may be required.

 

You can try using the LASTNONBLANKVALUE  function to get help.

https://community.powerbi.com/t5/Desktop/LASTNONBLANKVALUE-challenging-problem/m-p/1749034

Or consider using other similar time functions, such as Dateadd, EDATE and other functions

https://databear.com/power-bi-dax-sameperiodlastyear-paralellperiod-and-dateadd/

 

Best Regards,
Community Support Team _ Zeon Zheng
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

 

amitchandak
Super User
Super User

@Anonymous , first you should date table with time intelligence

 

Do you want to work with only working days?

Can you share sample data and sample output in table format? Or a sample pbix after removing sensitive data.

 

Check this example

Traveling Across Workdays - What is next/previous Working day
https://community.powerbi.com/t5/Community-Blog/Travelling-Across-Workdays-Decoding-Date-and-Calendar-4-5-Power/ba-p/1187766

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
Anonymous
Not applicable

yes only working days @amitchandak 

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

Sticker Challenge 2026 Carousel

Join our Community Sticker Challenge 2026

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

January Power BI Update Carousel

Power BI Monthly Update - January 2026

Check out the January 2026 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.