Data Studio
2.1K members online now
2.1K members online now
Ask questions about Data Studio
Guide Me
star_border
Reply

Invalid formula on CASE WHEN

Visitor ✭ ✭ ✭
# 1
Visitor ✭ ✭ ✭

Hi all, 

 

I am struggling to make a CASE formula works. 

Here is the formula: 

 

CASE 
WHEN lib_type = "DRIVE_CONTROLLED" THEN "Team folder" 
WHEN lib_type= "COMPOSITE" THEN "DMS" 
WHEN lib_type= "GOOGLE_DRIVE" THEN "Secured Folder"
ELSE "Unknown" 
END

lib_type is a text data. 

I don't know why but the editor keeps displaying invalid formula.

 

Thx for the help

1 Expert replyverified_user
1 ACCEPTED SOLUTION

Accepted Solutions
Marked as Best Answer.
Solution
Accepted by topic author Ismael H
December 2016

Invalid formula on CASE WHEN

Visitor ✭ ✭ ✭
# 3
Visitor ✭ ✭ ✭

Hi Alon, 

 

Indeed it was correct (semantically). My mistake was to assign this formula to...lib_type itself. 

I changed the input field and everything worked fine.

 

Thx

View solution in original post

Invalid formula on CASE WHEN

Google Employee
# 2
Google Employee

Hi Ismael -- I just tested the exact CASE statement and it worked ok. Suggestion: can you make sure that 1) lib_type is set to text in the Data Source page, 2) that lib_type turns into a green circle when you type it in the formula bar?

 

If neither of these works then please share the report with data-studio-help@google.com with edit access if possible and we can try to troubleshoot. Thanks!

Marked as Best Answer.
Solution
Accepted by topic author Ismael H
December 2016

Invalid formula on CASE WHEN

Visitor ✭ ✭ ✭
# 3
Visitor ✭ ✭ ✭

Hi Alon, 

 

Indeed it was correct (semantically). My mistake was to assign this formula to...lib_type itself. 

I changed the input field and everything worked fine.

 

Thx