The problem starts when looker suggests that you can use sql as a filter expression inside a measure, but I have been looking around and I can’t find anything.
I need to filter a measure based on a condition. example:
measure: dinamyc_tons {
type:sum
sql: ${Tons}
filters: [month: (month calculated by another dimension)]
}
It is easy to add month: “December” or month: “12” but instead or hardcoding the filter and the measure, i need it to be dinamyc and change based on the value provided by another dimension.
if you stop typing after filters:[] , looker throws an error that says:
Expecting '[', 'string', 'numeric', 'yes', 'no', 'asc', 'desc', 'sql', ';;', 'expression', 'html', 'js', 'identifier', '-', '*', got ']'
from there i understand i can then use sql to perform the filtering action but i can’t find how, can you guys help me ???
Hi Beto,
try to add another new dimension of type YesNo, which will check if month is equal calculated value
and then add that new dimension as a filter for your measure.
Thanks Tonya, i tried to implement something like that but it didnt work.
I need to grab the user input for the date filter on the dashboard and then based on that date i perform certain calculations, one of those calculations is to set a value in another dimension which is the one i really want to filter by.
Because in my DB table i have all possible combinations (catalogue) when i compare to a yes/no it will always return yes and then perform the wrong operation.
At least thats what i think its happening, because i checked and it says yes all the time and then returns a measure with wrong values.