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

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes! Register now.

Reply
Anonymous
Not applicable

Same Period Last Year

I have Date Dim and SPLY, in which you can see dates. Check image below.

I want to fetch date till 22-01-2020(and not till 31-01-2020) in Same Period Last Year because today's date is 22-01-2021.

Check below DAX measure I have written and the result of it in attached image.

_Measure =
CALCULATE(
CONCATENATEX (
VALUES(Dates[Date]),
Dates[Date],
UNICHAR(10)
),
SAMEPERIODLASTYEAR(Dates[Date])
)

image_2021_01_22T05_48_14_743Z.png

1 REPLY 1
amitchandak
Super User
Super User

@Anonymous , Try one of the 2. Make sure the date table is marked as a date table

 

_Measure =
CALCULATE(
CONCATENATEX (
VALUES(Dates[Date]),
Dates[Date],
UNICHAR(10)
),
dateadd(Dates[Date],-1, year)
)

 

or

 

_Measure =
CALCULATE(
CONCATENATEX (
VALUES(Dates[Date]),
Dates[Date],
UNICHAR(10)
),
datesmtd(dateadd(Dates[Date],-1, year))
)

 

Also refer this formula, You can embed you formula with filter of date , just an example. check how date filter of today -1 year is forced

 

LYMTD QTY forced=
var _max = date(year(today())-1,month(today()),day(today()))
return
if(max('Date'[Date])<=_max, CALCULATE(Sum('order'[Qty]),DATESMTD(dateadd('Date'[Date],-1,year)),'Date'[Date]<=_max), blank())
//OR
//CALCULATE(Sum('order'[Qty]),DATESMTD(dateadd('Date'[Date],-1,year)),'Date'[Date]<=_max)
//TOTALMTD(Sum('order'[Qty]),dateadd('Date'[Date],-1,year),'Date'[Date]<=_max)

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

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

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