Hi!
I want to have a table where I compare pageviews of that month to the pageviews in December previous year. I started out with a CASE WHEN function to get the pageviews of December:
CASE
WHEN YEAR(Date) = YEAR(CURRENT_DATE()) - 1
AND MONTH(Date) = 12
THEN Pageviews
ELSE NULL
END
But I always get this error message: Sorry, calculated fields can't mix metrics (aggregated values) and dimensions (non-aggregated values). Please check the aggregation types of the fields used in this formula.
Anyone know how I can solve this?
Solved! Go to Solution.
@Marloes1
In general Looker Studio is bit clumsy with options like theese and as a general rule of thumb you should always try to achieve computations related to dynamic data ranges utilizing SQL in BigQuery or Custom Query with date as parameter depending on the solution you need to create.
However, in this particular case you can try to do a work around by adding a fixed comparison date range.
Here you can select Fixed instead of Previous period
And select December month in the calendar. Now anything you choose in the date range drop-down should compare metrics to this fixed December.
I am not seeing a worklable solution withgh formulas but I must admin i barely use formulas and blending as here, in Bigglo we always use BigQuery as data source where we can freely do anything related to data manipulation, winndow functionsn, custom parameters and anytthhing really more advanced whihch cannot be done in Looker Studio directly.
@Marloes1
In general Looker Studio is bit clumsy with options like theese and as a general rule of thumb you should always try to achieve computations related to dynamic data ranges utilizing SQL in BigQuery or Custom Query with date as parameter depending on the solution you need to create.
However, in this particular case you can try to do a work around by adding a fixed comparison date range.
Here you can select Fixed instead of Previous period
And select December month in the calendar. Now anything you choose in the date range drop-down should compare metrics to this fixed December.
I am not seeing a worklable solution withgh formulas but I must admin i barely use formulas and blending as here, in Bigglo we always use BigQuery as data source where we can freely do anything related to data manipulation, winndow functionsn, custom parameters and anytthhing really more advanced whihch cannot be done in Looker Studio directly.
User | Count |
---|---|
3 | |
2 | |
1 | |
1 | |
1 |