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

Conditional Calculated Fields Error: Invalid formula

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

Hello,

 

I'm working with a PostgresSQL data source, trying to tally up a boolean field. The following formula was working last week:

 

SUM(CASE WHEN boolean_field = TRUE THEN 1 ELSE 0 END)

I had to delete that data source and start over. When entering the above formula again today, I'm getting an "Invalid formula" response — no indications which part is not working. I'm getting the same response when trying to do something as simple as:

 

SUM(1)

Can anyone point me to a status page or a known issue around custom formulas? I can't seem to get any of them to work. The AJAX request is succeeding (peeked in the Network inspector), with an error being returned in the body. Happy to provide any other details that may be helpful. Thanks!

 

Will

Conditional Calculated Fields Error: Invalid formula

Explorer ✭ ☆ ☆
# 2
Explorer ✭ ☆ ☆

I had a similar experience when I recreated a data source in Google Big Query. For some reason, the connection between Big Query and Data Studio breaks each time you make a new connection (even if the data and table name are all the same). My workaround for this was to create a new data source on Data Studio's side, connect to the Big Query table, and recreate the calculated fields. If you're only working with the boolean field, this shouldn't take long. It's not the most ideal situation when you have 20+ calculated fields that need to be remapped to the new data source...

 

Let me know if creating a new data source and redoing your calculated fields works!

Conditional Calculated Fields Error: Invalid formula

Visitor ✭ ✭ ✭
# 3
Visitor ✭ ✭ ✭

Thanks for the response. Creating a new data source did fix a few, but not all of the problems. It seems like every time I add a new data source, new things are fixed, and new things break. I'm battling a lot of inconsistencies, especially around date fields, and whether or not they will be parsed correctly, or show as invalid.

 

In the end I was able to avoid calculated fields by using the booleans as filters on larger data inside the report builder. That doesn't fix this issue, but was a workaround.

Conditional Calculated Fields Error: Invalid formula

Explorer ✭ ☆ ☆
# 4
Explorer ✭ ☆ ☆

I'm sure you've read this elsewhere, but the date fields work best when in the default Google format (YYYMMDD). I ran into a few issues when the format didn't start out as that.

 

Best of luck on fixing the other issues. Data Studio has a lot of potential, but these technical problems can get frustrating for all of us!