M.T Davis
M.T Davis

Reputation: 1098

Case When Statement in Google Data Studio not working

I'm trying to create a CASE WHEN statement in Google Data Studio. However, it not applying to my table. I tried a few combinations and nothing seems to work. It also says that the syntax is valid.

Upvotes: 2

Views: 1176

Answers (1)

Nimantha
Nimantha

Reputation: 6471

It can be achieved using the 3 Calculated Fields below:

1) Metric (Needs Intervention)

COUNT(CASE
    WHEN Absenteeism Avg in Days > 15 THEN "Needs Intervention"
    ELSE NULL END)

2) Metric (Stable)

COUNT(CASE
    WHEN Absenteeism Avg in Days <= 15 THEN "Stable"
    ELSE NULL END)

3) Dimension (Needs Intervention / Stable)

CASE
  WHEN Absenteeism Avg in Days > 15 THEN "Needs Intervention"
  ELSE "Stable"
END

Google Data Studio Report and a GIF to elaborate:

Upvotes: 3

Related Questions