How to calculate the year-over-year change rate which is based on a day of the week instead of using the same day for the different years.
Typically a year-over-year change is based on a date such as 12/10/2022 and the calculation would be SUM(12/01/2022 - 12/10/2022)/Sum(12/01/2021-12/10/2021).
This solution is based on a day of the week instead of a specific date. For example, if this year's data is from Thursday (12/1/2022) to Saturday (12/10/2022) and we want to use last year's data from the same weekday, it would be Thursday 12/2/2021.
IF ISOWEEKDAY(DATETRUNC('month',[Select a Day]))-ISOWEEKDAY(DATEADD('year',-1,DATETRUNC('month',[Select a Day]))) > 0
THEN ISOWEEKDAY(DATETRUNC('month',[Select a Day]))-ISOWEEKDAY(DATEADD('year',-1,DATETRUNC('month',[Select a Day])))
ELSE 7+ISOWEEKDAY(DATETRUNC('month',[Select a Day]))-ISOWEEKDAY(DATEADD('year',-1,DATETRUNC('month',[Select a Day])))
END
IF [Order Date]>=DATETRUNC('month',[Select a Day]) AND [Order Date]<=[Select a Day]
THEN [Quantity]
END
IF [Order Date]>=DATETRUNC('month',DATEADD('year',-1,[Select a Day]))+[Weekday difference] AND [Order Date]<=DATEADD('year',-1,[Select a Day])+[Weekday difference]
THEN [Quantity]
END
SUM([MTD SUM]) / SUM([MTD SUM with same Weekday])
001464367
1204 KB

We use three kinds of cookies on our websites: required, functional, and advertising. You can choose whether functional and advertising cookies apply. Click on the different cookie categories to find out more about each category and to change the default settings.
Privacy Statement
Required cookies are necessary for basic website functionality. Some examples include: session cookies needed to transmit the website, authentication cookies, and security cookies.
Functional cookies enhance functions, performance, and services on the website. Some examples include: cookies used to analyze site traffic, cookies used for market research, and cookies used to display advertising that is not directed to a particular individual.
Advertising cookies track activity across websites in order to understand a viewer’s interests, and direct them specific marketing. Some examples include: cookies used for remarketing, or interest-based advertising.