Pieter le Roux
Pieter le Roux

Reputation: 69

Workaround for not being able to use calculated field in a CASE statement

I'm trying to create a field that only calculates when another calculated field is >= 100%. But when I try CASE WHEN Performance >= 1 THEN Product Count * 20 ELSE 0 then it says Invalid Formula. Is there a workaround for this?

Upvotes: 1

Views: 574

Answers (2)

Nimantha
Nimantha

Reputation: 6471

It can be achieved with a single Calculated Field:

Product Count * (CASE
    WHEN Performance >= 1 THEN 20
    ELSE 0 END)

Google Data Studio Report and a GIF to elaborate:

Upvotes: 0

Gegenwind
Gegenwind

Reputation: 1428

Thats because you cannot use a formula in a then condition. Instead you need to create a calculated field that contains product count * 20. Then you can use that field as value of the then condition.

Read more here: https://support.google.com/datastudio/answer/7020724

Upvotes: 1

Related Questions