Error Message when creating Custom Measure - 'Filtered measures must have a filter expression that results in a "yesno"

lookml
low_priority
done
reply
(Lisa Eugene) #1

I created a custom measure that’s just one measure divided by another. Those component measures are unfiltered. I get this error message when I try to run it saying " Filtered measures must have a filter expression that results in a “yesno”.

I can’t find anything in Measures or Error Messages documentation that will help me decipher what this means. Anybody have an idea what this means, so I can fix my custom measure?

0 Likes

(Menashe Hamm) #2

I don’t know, sorry, and I hope someone else can answer. But a possible workaround is to use table calculations instead: include both the measures in your table of results, as well as a table calculation that’s their quotient.

0 Likes

(Izzy) #3

I think @menashe’s idea is a good one!

There’s 2 kinds of “Custom Measures”: The kind that pop up when you click the gear icon on a dimension:
image
that let you create on the fly maxes, sums, etc.

and the kind that pop up when you click the gear icon on a measure: image
This second kind (which it sounds like is the kind you’re using) actually only let you add custom filters to measures. Like the error says, those filter expressions must result in either yes or no (like, 1=1 (results in yes) or 2=1 (results in no).

My guess is you’re trying to add

${measure1}/${measure2} in that filters area, and since that != yes or no (probably equals some number), it’s throwing the error.

Table calc is a good call!

0 Likes

(Izzy) #4

And if I’m way wrong on that, then sorry in advance for the long explanation full of assumptions :slight_smile:

0 Likes

(Scott Smith) #5

I’m trying to create a custom measure with a conditional statement like this:

if(${cmdashboards.sort_order}=3,(${cmdashboards.cat_count}*100), ${cmdashboards.cat_count})

So, if my sort_order dimension = 3, then multiply my existing measure by 100, otherwise just show the existing measure.

I’m getting that same error message. Probably, I’m just using it wrong. I’m new to Looker so be gentle. :smile:

0 Likes

(Izzy) #6

My advice here is the same as what I suggested to Lisa! It sounds like you’re trying to make a “Custom Measure”, and putting that if logic into the filter area there. However, that area’s designed to just filter down a measure, not actually do any transformations to it.

You should make a new Table Calculation instead of a custom measure, and put that conditional statement in there— See if that works!

0 Likes

(Scott Smith) #7

Thanks for the reply and the information, izzy. I’ll go that route.

0 Likes