'AWS Quicksight Convert week number and year to a date field

Would Anyone know how to convert a week number and year to a date field. Everything I have tried fails.



Solution 1:[1]

I am assuming your 'week number' and 'year' data are integers with week 1 being equivalent to January 1st, see data sample below. Then the Quicksight calculated field formula is (for dayfirst date):

addDateTime((week_number*7)-7,'DD',parseDate(concat('01/01/',toString(year)), 'dd/MM/yyyy') )

You will have to adapt the formula for the relevant data types of your own columns. E.g. if your week_number and year columns were strings then the formula would be:

addDateTime((parseInt(week_number)*7)-7,'DD',parseDate(concat('01/01/',year), 'dd/MM/yyyy'))

Data sample with output: enter image description here

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1