Justin
Justin

Reputation: 3039

Simple formula not working in google data studio connector?

I'm working on a data studio connector, and trying to do a very simple formula. I simply want divide a field by 100.

  {
    id: "ctr",
    dataType: "NUMBER",
    semantics: { conceptType: "METRIC", semanticType: "NUMBER" },
    formula: "$ctr / 100",
    name: "ctr",
    label: "Ctr"
  }

Google data studio gives an error when using it. "Sorry, we encountered an error and were unable to complete your request."

If I remove the formula line, all works fine. What is up here?

I know I can reference another field with $myfieldid though I want to reference the current field, in this case ‘ctr’. It also helps me avoid extra fields in my schema I’m just using for calculation.

Anyone one run into a similar issue? Is this possible?

Upvotes: 1

Views: 495

Answers (1)

Clayton Oliveira
Clayton Oliveira

Reputation: 643

You are defining the field with id 'ctr' and using it's value inside the same block.

You should create a new field to use '$ctr' value and then perform your calculation over it.

At this time i don't think there's a way to reference itself on the filed definition.

What you could do is set that field as "isHidden": true so it doesn't appear for the user and you only use it as a parameter on another field.

Upvotes: 1

Related Questions