Skip to main content

Hi, I am trying to compare Unique Users YTD (1 Jan 2021 to yesterday) with Unique Users same period last year. While I am able to select "This year to yesterday" to run YTD stats, the only way to enter the same period last year is to type the range manually, but that means that every time I want to refresh extract, I will need to type in the new end day. My question is, if there is a way to automate this?

I also need to compare current month to date with same period last month, and facing the same problem.

5 respuestas
  1. 4 nov 2021, 21:04

    @Agata Lukasiewicz​ 

    Hi, when connecting to Google Analytics you could use the Fixed Start option, and then type in from Jan 1st 2020

    @Agata Lukasiewicz​ Hi, when connecting to Google Analytics you could use the Fixed Start option, and then type in from Jan 1st 2020After that you would have to years of data.After that you would have to years of data.

     

    Then you can create a calc like this to obatain the maximum date:

    Max Date:

    {MAX(Date)}

    Then, you can create a calc to show the YTD Users:

    YTD Users:

    SUM(IF [Date]<=DATEADD("year",-DATEDIFF("year",[Date],[Max Date]),[Max Date]) THEN [Users] END)

    and then create your viz, by dragging Year(Date) to columns, and YTD Users to Rows.

     

    For the MTD Users, you could use something like:

    SUM(IF [Date]<=DATEADD("year",-DATEDIFF("year",[Date],[Max Date]),[Max Date]) AND

     

    [Date]>=DATETRUNC("month",DATEADD("year",-DATEDIFF("year",[Date],[Max Date]),[Max Date]))

     

    THEN [Users] END)

    imageIf this post resolves the question, would you be so kind to "Select as Best"?. This will help other users find the same answer/resolution and help community keep track of answered questions. Thank you.

     

    Regards,

     

    Diego

    Tableau Ambassador