Please note that below are some of the most common questions we receive regarding the user of Looker. We will continue to update this space when we receive questions which may affect all DE 2.0 users.
Question 1. CAST function
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?
Response
CAST is not a function that is currently available in DE 2.0 (see attached screenshot titled "CAST" for reference). We have a list of functions that are actually available in DE 2.0 along with their corresponding rule. You will more information in the attached PDF file (titled "DE 2.0 Functions"). 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}
A screenshot of an example of your report is attached (titled DE 2.0) that shows the end results of the calculations we suggested above.
- DE 2.0 Functions.pdf200 KB
Comments
0 comments
Article is closed for comments.