I am looking to for a calculated field that shows the number of views in the first 12 months since launch for multiple companies that have different launch dates, so that I can compare how companies stack up in their first month, second month etc.
We use the view_created_at to identify when a view is created and we count the view_id, which is always tied to a view_created_at date_dimension. Companys have a company_created_at which is tied to a company ID
Hi @DataDude1 ,
For calculating views in first 12 months since launch, I would create a conditional check between the company_created_at and view_created_at fields to check if the duration is less than equal to 12 months then return view_id.
And use the count of the calculated field to fetch the view count.
However, if the requirement is to understand view trend for first month, second month,… , then I would think about creating a field that gives me Launch month serial no. using date difference of the 2 date fields.
Both the solutions are considering the date fields and view_id are from the same dataset and the dataset is at company_id and view_id level.
If the dataset has different schema, kindly share a sample of the dataset schema.
Thanks,
Prantika
Hi Prantika,
Both fields do come from the same dataset. Do you know the calculation I would use to set up that field that gives you the launch month serial number using the two different date fields?
Try out something like:
dateDiff(truncDate(‘MM’,company_created_at), truncDate(‘MM’,view_created_at),‘MM’) + 1
The +1 at the end is done to adjust the offset, else the months serial would appear as 0,1,2…
Did this solution work for you? I am marking this reply as, “Solution,” but let us know if this is not resolved. Thanks for posting your questions on the Quick Sight Community!