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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

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
PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.