When I try to create a custom measure based on a string with the measure type "List of unique values" and I try to set filters, I get the following error:
If I only change the measure type to "Count distinct", then it works. Also, when I use the "List of unique values" type, and I transform the filters to be custom filters, then it works.
Has anyone experienced this problem?
Solved! Go to Solution.
Thanks for sharing! That does look like valid SQL, and the correct SQL for what we want to compute.
Based on the error messages, my testing, and your testing, my hypothesis is as follows:
Hey there! This isn't a bug, this is a known limitation.
Non aggregate measure types cannot be filtered on. From our Measure types documentation:
number
and yesno
. These measure types perform simple transformations, and since they do not perform aggregations, can reference only aggregate measures or previously-aggregated dimensions. You cannot use the filters
parameter with these measure types.As you've figured out, the way to get around this is to use an aggregate type of measure, such as a count distinct or a list.
Hi, @sam8 ! Thanks for your response! Actually I am using an aggregate measure as far as I know. Isn't the "List of unique values" an aggregation over values?
The problem is that this does not work and raises the error pointed out above:
But if I try to do the same thing using the Custom filter, it works:
Both images above were expected to generate the same result in my opinion.
Oh yeah, I totally agree! Both images should show the same thing. I think I misunderstood your original question.
When I tried, both failed with the following error message:
Hi, @sam8 !
This is how the field gets compiled:
STRING_AGG(DISTINCT CAST(CASE WHEN ( subscriptions.bl_has_platform_access AND ( subscriptions.nm_type = 'paid')) AND (NOT (( COALESCE(subscriptions.dt_canceled_at < subscriptions.dt_expires_in OR subscriptions.nm_canceled_by_email IS NOT NULL, FALSE) ))) THEN subscriptions.nm_plan_label ELSE NULL END AS STRING), '|RECORD|') AS xxx
Thanks for sharing! That does look like valid SQL, and the correct SQL for what we want to compute.
Based on the error messages, my testing, and your testing, my hypothesis is as follows:
Thanks @sam8 ! Good to know that there is already a feature request for this! I'll upvote it!