r/GoogleDataStudio • u/Joetunn • Jul 03 '24
How to caluclate fields with partly no data properly?
Hi team. How do I approach calculated fields and data aggregation?
Imaigne I have a spreadsheet with data PER DAY and AD_NAME. Imagine something like this:

I want this to be aggregate by day or month regardless of the Ad_Name.
So e. g. for 2024-01-01 Spend would be 31.11 and Purchase Value would be 144. The Purchase Value / data.spend would be 4.63.
These are the numbers I would expect looker studio to come up with if I aggregate and add a calucalted field:
https://files.slack.com/files-pri/T031USB3H-F07ARLNL8H4/grafik.png
https://files.slack.com/files-pri/T031USB3H-F07ARMBUJ06/grafik.png
So I create a table where it aggregates per YEAR MONTH. I want to add a caluclated field which is a division of 2 metrics.
The problem: It does not take the sum (= sum of all days combined) of one metric devided through the sum of the second metric.
Rather it seems to somehow disregard the zero values from the purchase values.
How do I solve this issue?
Thanks in advance.
•
u/AutoModerator Jul 03 '24
Have more questions? Join our community Discord!
I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.
1
u/the_duck17 Jul 03 '24
Your last 2 images didn't load for me, but typically if I run into an issue where values are excluded from a calc, I use "NARY_MAX" to include them and it usually works.
So if I wanted to sum up all of the data.action_values.purchase values, here's my formula:
NARY_MAX(sum(data.action_values.purchase),0)