Summary
Use Either #1 or #2.
To elaborate on the difference between using "True"
and TRUE
, the Semantic Type of:
- #1 is Boolean (
TRUE
or FALSE
);
- #2 is a Text field (note the quotes around
"TRUE"
or "FALSE"
):
The Conditional Function, IF
, was introduced in the 11 Mar 2021 Update; thus, tweaking the IF
function in the question now works as expected in Google Data Studio.
Note: The Calculated Field below is a Boolean field; thus, to create a Text field, replace TRUE
with "TRUE"
and replace FALSE
with "FALSE"
:
IF(Cost > 0 AND Orders = 0, TRUE, FALSE)
Alternatively, the CASE
statement proposed in the question should work as expected. That said, the CASE
statement below explicitly states the ELSE
clause.
Note: The Calculated Field below is a Text field; thus, to create a Boolean field, replace "TRUE"
with TRUE
and replace "FALSE"
with FALSE
:
CASE
WHEN Cost > 0 AND Orders = 0 THEN "TRUE"
ELSE "FALSE"
END
Editable Google Data Studio Report and a GIF to elaborate: