Carson Gregory
03/09/2022, 11:20 PMproject_id, device_id, datetime
1, 543, 2021-01-21
1, 543, 2021-02-21
1, 543, 2021-03-21
1, 123, 2022-01-22
1, 123, 2022-02-22
1, 456, 2022-03-22
("datetime" field can be either a date object, or an attribute.)
Assume today is 2022-03-31
And I have a date filter applied of last 90 days.
Questions:
1. How can I write metrics that select min and max date within a period? Ultimately, striving to produce a 'Table' or other insight to show:
min_previous_period, 2021-01-21
max_previous_period, 2021-03-21
min_this_period, 2022-01-22
max_this_period, 2022-03-22
2. Does GDCN have any mechanism to adjust this-period and previous-period to ensure match Day of Week as closely as possible?Martin Svadlenka
03/11/2022, 8:31 AMDavid Ramirez
03/11/2022, 7:48 PMselect min({fact/datenum});
David Ramirez
03/11/2022, 8:12 PMCarson Gregory
03/12/2022, 12:47 AM####-##-##
formatting. Is there any way to convert this e.g. '20220311' to different date formats e.g. 'Fri Mar 11, 20202'?
For #2 I am doing Year Over Year calculations, and so want to compare e.g. today to last year +/- the required number of days so that I am comparing a Friday to a Friday.
Fri march 11, 2022
- 1year = Thursday march 11, 2021
So instead would want to do -1year +1 day to account for the Day of Week change.David Kubecka
03/12/2022, 7:09 AMFOR PREVIOUS({week attribute}, 52)
Carson Gregory
03/16/2022, 6:10 PMDavid Kubecka
03/18/2022, 1:10 PMDavid Kubecka
03/18/2022, 1:12 PMFOR PREVIOUS({week attribute}, 52)
solve your issue? Because that works exactly as you seem to want, i.e. if today is Friday that construct wil give the Friday closet to one year ago.Carson Gregory
03/22/2022, 8:44 PMCarson Gregory
03/22/2022, 8:49 PMDavid Kubecka
03/23/2022, 9:55 AMshow me sum of X for the last 90 days in the datasetThis is currently not possible in GD.CN. Note however, that the
Total Sales - period ago
measure dynamically reacts to a filter you could have set up for your users in your app. The Heroku example is obviously simplified and therefore doesn't work well precisely because there's hardcoded newRelativeDateFilter
which is not what you should do in you interactive app.