cancel
Showing results for
Did you mean:
Super User

## 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.

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
Super User

@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))

!! Microsoft Fabric !!
Microsoft Power BI Learning Resources, 2023 !!
Learn Power BI - Full Course with Dec-2022, with Window, Index, Offset, 100+ Topics !!
Did I answer your question? Mark my post as a solution! Appreciate your Kudos !! Proud to be a Super User! !!
5 REPLIES 5
Super User

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

Frequent Visitor

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

Super User

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

Super User

@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))

!! Microsoft Fabric !!
Microsoft Power BI Learning Resources, 2023 !!
Learn Power BI - Full Course with Dec-2022, with Window, Index, Offset, 100+ Topics !!
Did I answer your question? Mark my post as a solution! Appreciate your Kudos !! Proud to be a Super User! !!
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.