Hi,
Does anyone know how to get revenue displaying with non-null source, medium channels?
Thank you in advance!
Simple SQL syntax below:
SELECT
((SELECT value.string_value FROM UNNEST(event_params) WHERE key = 'source')) AS source,
((SELECT value.string_value FROM UNNEST(event_params) WHERE key = 'medium')) AS medium,
SUM(ecommerce.purchase_revenue) AS revenue,
SUM(ecommerce.purchase_revenue_in_usd) AS revenue_usd
FROM
`dataset`
GROUP BY
source,
medium
Result returns:
Rowsourcemediumrevenue****revenue_usd
| 1 | null |
null |
10000 |
100 |
|---|---|---|---|---|
| 2 | cpc |
null |
null |
|
| 3 | adroll |
null |
null |
|
| 4 | display |
null |
null |
|
| 5 | organic |
null |
null |
|
| 6 | m.facebook.com |
referral |
null |
null |
| 7 | ads.as.criteo.com |
referral |
null |
null |
Am trying to get something like this instead:
Rowsourcemediumrevenue****revenue_usd
| 1 | null |
null |
100 |
1 |
|
|---|---|---|---|---|---|
| 2 | cpc |
200 |
2 |
||
| 3 | adroll |
400 |
4 |
||
| 4 | display |
500 |
5 |
||
| 5 | organic |
6000 |
60 |
||
| 6 | m.facebook.com |
referral |
700 |
7 |
|
| 7 | ads.as.criteo.com |
referral |
15000 |
150 |