'Compare number of users on year ago

I want to get the count of distinct current users and one year ago using sql I have used the following query but it gets the current number and zero for one year ago values.

   select CAST(root_tstamp as DATE) as Date,
   count(DISTINCT userid) as sign_ups,
   count(Distinct case when CAST(root_tstamp as DATE) = ADD_MONTHS(CAST(root_tstamp as 
    DATE),-12) then userid end) as Last_year_Signups
   FROM table1
sql


Sources

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

Source: Stack Overflow

Solution Source