Question
Under Employee Group Names, I extracted the number (either 2 or 3) into "Multiplier" custom expression via string function.
I then want to do a "Multiplier" x "Visit Scheduled Hours Sum" to get units. (as these are student volunteers who visit clients, and instead of 1 visit = 1 visit scheduled hours sum, it's technically 2 or 3hours total per student, as they visit in a group).
Looker can't read "Multiplier" as a number as it was a string to begin with. I did a CAS custom expression:
CAST(${multiplier} AS INTEGER*${visit_tier_5.visit_sum_scheduled_duration})
but Looker indicated expression incompleted.
I went online to Looker community and they indicated to use CAST function. Not sure where I went wrong?
Please advise, thanks.
Answer
As it turns the CAST function is not a function that is currently available in DE 2.0 (see attached screenshot titled "CAST" for reference).
We do have a list of functions that are actually available in DE 2.0 along with their corresponding rule which we attached as a PDF file (titled "DE 2.0 Functions") to this reply for your convenience.
To get the results that you're looking for, we recommend creating an additional custom calculation that converts the Multiper String column to a Number. You can do this using the to_number function shown below:
to_number(${multiplier})
Then in your custom calculation for the Units column, you can use the Multiplier function shown below to get the results you need:
${test}*${visittier5.visitsumscheduled_duration}
We've attached a screenshot of an example of your report (titled DE 2.0) that shows the end results of the calculations we suggested above.
Comments
0 comments
Article is closed for comments.