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
NewbieJono
Post Patron
Post Patron

Compare to the same day last year

Hello all,  on a chart, can i compare to the same day last year. e.g compare Monday to the previous years closest Monday. At the momene my chart looks like this.

 

Capture.PNG

 

As you can see the comparison is out of sync.

 

Here is the dax i use

 

Mail Received Previous Year = calculate([Total MailReceived],SAMEPERIODLASTYEAR('DIM - Date Table'[Date]))

 

1 ACCEPTED SOLUTION

@NewbieJono , Please try a suggestion from @ashwinwullems , same week day last year is 364 days behind. So should work for leap year too

 

example

 

week Year behind Sales = CALCULATE(SUM(Sales[Sales Amount]),dateadd('Date'[Date],-364,DAY))

View solution in original post

5 REPLIES 5
NewbieJono
Post Patron
Post Patron

Yes Monday is peak day, just wanted to match them up. Does anyone know what the dax for this would be

you can try dateadd ( <Dates>, -52*7, DAYS

what does this do,  would it deal with a leap year?

@NewbieJono , Please try a suggestion from @ashwinwullems , same week day last year is 364 days behind. So should work for leap year too

 

example

 

week Year behind Sales = CALCULATE(SUM(Sales[Sales Amount]),dateadd('Date'[Date],-364,DAY))

ashwinwullems
Frequent Visitor

Sameperiodlastyear is the exact date from last year. If this is sales related there might be a discrepancy in dates vs sales dates (weekdays vs weekends).

 

You can try using some form of dateadd to get the dates closer to eachother.

 DATEADD ( <Dates>, -365, DAY 

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.