Custom Expression Error - v. 0.25.2

Hi, tring to create a custom metric from Bigquery database... getting this issue:
image

What am I missing?

Thanks,
Raz

Hi Raz,

just checked and I think you can´t use sum sadly (at least for now):

“Right now, you can only use the following math operators in your formulas: +, –, * (multiplication), and / (division). You can also use parentheses to clarify the order of operations.”

As the red marking around the field indicates the equation is not accepted.
Not sure what you want to get with your question but you could
a) just write the equation like “Mins” / 100 and then in the View section build the sum of it or
b) build your question in SQL.

Hope that helps, cheers, Eva

Thanks Eva,

I have a field which states the number of Minutes each of our employees worked on clients... I would like to create a custom metric which "translates" this into hours for easier viewing - hence the /60.

The metric is called "mins" and I tried doing it the way you mentioned and I am still getting errors:

image

Is this kind of custom metric even possible?

Thanks for all the help!
Raz

Hi Raz,
does the field "mins" show up in the field list?

What works for me is to choose the field from that list and then also choose the mathematical operator from the drop down list (just to make sure that I don´t forget a space or something somewhere ...

I have a custom metric that looks like that and works:

The difference I see to your picture is that there seems to be a space between the / and the 100?

But I use an SQL database, not bigQuery and I use v0.25.1.
Not sure if that makes a difference though.

Hope you figure it out! Otherwise if you need help with the SQL query just let me know.
Cheers, Eva

Thanks Eva,

It works now, the issue was to put " at the beginning and end of the field inside the parenthesis (it disappears straight after but enables the custom metric)

image

How strange...

Hi,
glad that it works now, but yes, strange. Good to know though that working with sum() seems possible :slight_smile:

One clarifier: the documentation quoted above is regarding custom fields rather than custom expressions (or metrics). Eva's screenshots are from the custom field UI, and Raz's are from the custom expression UI. I occasionally get momentarily confused about the distinction myself.

Custom fields basically let you do simple arithmetic on fields or between fields in order to create a new field, and can't include aggregations because that would "squash" the field. Custom expressions/metrics can include arithmetic and basic aggregation functions (sum, average, etc.), but those aggregation functions can't include additional aggregations inside of themselves.

Ah, that explains it! Thanks and sorry for the wrong screenshots. Have to dig into custom expressions/metrics then :slight_smile: