First and last week of the year

Reply
White Belt

First and last week of the year

When building cards and having it weekly, my cards always shows a dip at the end/beginning of each year. 

 

This is because week 1 and week 53 are typically shorter.

 

Has anybody came up with a method to combine these accurately? 

 

past year by week.png

 


Accepted Solutions
Red Belt

Re: First and last week of the year

Try this beastmode and use it as your x-axis

 

CASE
WHEN WEEK(`TransactionDate`, 11) = 1
THEN STR_TO_DATE(CONCAT('12-31-', YEAR(`TransactionDate`) - 1), '%m-%d-%Y')
ELSE `TransactionDate`
END

Domo Arigato!

**Say 'Thanks' by clicking the thumbs up in the post that helped you.
**Please mark the post that solves your problem as 'Accepted Solution'

All Replies
Red Belt

Re: First and last week of the year

Try this beastmode and use it as your x-axis

 

CASE
WHEN WEEK(`TransactionDate`, 11) = 1
THEN STR_TO_DATE(CONCAT('12-31-', YEAR(`TransactionDate`) - 1), '%m-%d-%Y')
ELSE `TransactionDate`
END

Domo Arigato!

**Say 'Thanks' by clicking the thumbs up in the post that helped you.
**Please mark the post that solves your problem as 'Accepted Solution'
Moderator

Re: First and last week of the year

@gatormain, did @Godiepi's reply help you out?

White Belt

Re: First and last week of the year

Do you know if there are any soultions that will not shift the acutal date of the transaction? Trying to leave the cards with the ability to change the by date dimension without skewing the data.

Announcements
Dojo Day is Coming! Mark your calendars for May 30th 0900-1700 MST Click here for more information