I am working on a tableau function that I need assistance with. In one of our workbooks, we use a YoY date calculation to compare website sessions over time. The calculation allows us to equalize two sets of years in order to compare the same period of time in one chart. Our data is based on our financial year (FY), and our financial year starts on April 1st. Here is the function:
IF (month(today()) < 4 AND [Session Date FY] < DATETIME(STR(YEAR(TODAY())-1)+"-04-01 00:00"))
THEN dateadd('day',364,[Session Date FY])
ELSEIF (month(today()) >=4 AND [Session Date FY] < DATETIME(STR(YEAR(TODAY()))+"-04-01 00:00"))
THEN dateadd('day',364,[Session Date FY]) ELSE [Session Date FY] END
I am now trying to add a third year to the function so that I can compare the same day or period of time over three years. I know I need to add a line that looks back two years rather than one year, and likely include a dateadd('day',728 ,[Session Date FY]) but I am struggling to put this all together. Any assistance would be much appreciated!
Aucun commentaire:
Enregistrer un commentaire