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

Data Studio, issue with add field

[ Edited ]
Visitor ✭ ✭ ✭
# 1
Visitor ✭ ✭ ✭

Hello,

 

I have some problem with the add field function in edit data source, I have read the help document about "calculated field": https://support.google.com/360suite/datastudio/answer/6299685?hl=en .

 

But I could not use it, not only mathematic functions, but also arithmetic operators. Even if I input "search_count + 1" in the formula blank, it still does not work, "search_count" is a metric and is number type. The error message is always "invalid input expression".

 

I have been struggling with this problem for at least one week, Is there anyone know how to solve this problem.

 

Thank you for kind help.

 

Tao Z

1 Expert replyverified_user

Re: Data Studio, issue with add field

Google Employee
# 2
Google Employee
It would help us diagnose this if you could file feedback from the product using the feedback button (upper right corner) when the problem occurs. Can you please do that?

Re: Data Studio, issue with add field

Visitor ✭ ✭ ✭
# 3
Visitor ✭ ✭ ✭
Yes, sure, I have already done that.

Re: Data Studio, issue with add field

Visitor ✭ ✭ ✭
# 4
Visitor ✭ ✭ ✭
I am having the same issue. I tried to use a case when logic to create a caclulated string field, and having the invalid input expression error. I have already provided feedback and waiting for the response.

Re: Data Studio, issue with add field

Visitor ✭ ✭ ✭
# 5
Visitor ✭ ✭ ✭
I have solved that problem with google support recently, you can tell me about how do you use it, maybe I can help.

Re: Data Studio, issue with add field

Visitor ✭ ✭ ✭
# 6
Visitor ✭ ✭ ✭
I am using bigquery as source, and following is my calculated field formula:

CASE WHEN LEG1_Cabin = "Economy" THEN concat(LEG1_Cabin,'-',LEG1_PremiumFlex) ELSE LEG1_Cabin end

Here Leg1_Cabin and Leg1_PremiumFlex are Text type fields. Is there something I am doing wrong here?

Re: Data Studio, issue with add field

Visitor ✭ ✭ ✭
# 7
Visitor ✭ ✭ ✭
What is the error message ? Is there any error if you only use this formula:
concat(LEG1_Cabin,'-',LEG1_PremiumFlex)

Re: Data Studio, issue with add field

Visitor ✭ ✭ ✭
# 8
Visitor ✭ ✭ ✭
The error message with the earlier formula is:
Invalid input expression - Invalid input expression.

With your suggested formula, I get the following: Unable to retrieve data.

It seems like a data connection/retrieval issue, but at least the forumla seems to be fine.

Re: Data Studio, issue with add field

Visitor ✭ ✭ ✭
# 9
Visitor ✭ ✭ ✭
I have tested your formula. I think the problem is that concat function can only accept two parameters.
You can try CONCAT(LEG1_Cabin, CONCAT('-',LEG1_PremiumFlex)). If there is still any problem, you may need to check out the data type.

CONCAT(X, Y)
Summary
Returns a text that is the concatenation of X and Y. Note that either X or Y must be an expression that has at least one field; the other can be a text literal. Arguments must be either both aggregated or both unaggregated.
X
X is a field name or expression.
Y
Y is a field name or expression.
Examples
CONCAT('Browser:', CONCAT(browser, CONCAT('Version:', version_number)))
CONCAT('Text: ', CONCAT(revenue, CONCAT(clicks, sessions)))

Re: Data Studio, issue with add field

Visitor ✭ ✭ ✭
# 10
Visitor ✭ ✭ ✭
Hi Tao,

I have noticed that earlier, but if you look at the calculated field documentation, it seems like multiple argument works with Concat: https://support.google.com/360suite/datastudio/answer/6299685?hl=en#functions

Examples:
CASE WHEN Favorite Color = "blue" THEN "Me, too!" ELSE "boo" END
MAX(Wait Time) + 1
CONCAT('Browser:', t0._browser_, 'Version:', t0._version_number_)

I have tried using two arguments only:

CASE WHEN LEG1_Cabin = "Economy" THEN concat(LEG1_Cabin,LEG1_PremiumFlex) ELSE LEG1_Cabin end

still throwing the same error.

Also, to test the data retrieval error, I used the following formula:
concat('test1','test2')
but even that one is giving "Unable to retrieve data" data.