Philippe Hébert
02/02/2022, 8:50 PMMichal Hauzírek
02/02/2022, 9:37 PMSELECT
(THIS - Date (Birthdate))/365
WHERE Date (Birthdate)>(empty value)
+ 0*(COUNT(personID))
• THIS - Date (Birthdate) would be number of days since the birthdate
• divided by 365 would return this value in years with decimals
• the WHERE condition is there to exclude any instance where we would have empty birthdate
• and the 0*COUNT … is a trick to make sure we only get data for dates which really exist in the person dataset and not the whole date dimension. (but since we are multiplying it by 0 it will in no way affect the resultMal Sharkey
02/03/2022, 12:05 PMSELECT
(THIS - Date (AcquisitionDate)/365
+ 0 * COUNT(AssetId)
But when I add the where clause:
SELECT
(THIS - Date (AcquisitionDate)/365
WHERE Date (AcquisitionDate) <> (empty value)
+ 0 * COUNT(AssetId)
I get an error:
Unexpected 'e'. Expecting: SELECT, RANKFUNCNAME, ZERO, FUNCNAME1, FUNCNAMEN, FUNCNAME2, TEXT_ELEM, OBJECT, FUNCNAME12, COUNT, SHORT_STRING, REPORT, PREVIOUS, PERCENTILE, IDENTIFIER, IFNULL, CASE, NEXT, NATURAL, STRING, IF, RUNFUNCNAME, (, REAL, ELEM_IDENTIFIER, -, THIS
Any idea what's causing this? Thanks!Michal Hauzírek
02/03/2022, 1:15 PMMichal Hauzírek
02/03/2022, 4:16 PMTHIS - Date (AcquisitionDate)
returns a large number (number of days since 1900) and in case you have some aggregation above it, like average age, it can skew the result significantly.Mal Sharkey
02/03/2022, 9:50 PMPhilippe Hébert
02/04/2022, 1:29 PM