Hi @Evlime, if you want to have calculations in columns, while your metrics are in rows, you probably want to make use of calculated items. You could use an existing dimension that you have in pages, make it a single selection via page options, and place it on columns, so that you can add calculated items to it. Or, you could create a dimension that is designed for that purpose, e.g. containing a single item “Value”, and add it to your metrics, so you can then place it on your columns and add the calculated items.
Generally there are three ways of bringing calculations to Views:
- In the metric itself → This is often not feasible for divisions or multiplications, because the level of aggregation has an impact on your result and metrics always calculate at the most granular level. E.g. if you have “Region” in your pages and multiple or all items selected, and the AVG calculation is done within the metric itself, AVG would first be calculated for each region and then summed up to selected/all regions.
- As calculated item → For any dimension residing in rows or columns, you can add calculated items, read more in the linked article.
- As “Show value as” metric → Would not work in your case, if you want the calculations to be performed in columns, while your metrics are in rows. Read more about show value as in the linked article.
One way 3. would work - which is probably not suitable here, but could work well in similar situations - could be to have revenue, cost etc not as metrics, but instead as a dedicated dimension, e.g. “PnL statement”. Then you would have only one metric, could put that into columns and make use of the “Show value as” option. Your gross profit could then be a calculated item of that “PnL Statement” dimension. However, this can get tricky depending on the complexity of your calculated items, as you cannot reuse a calculated item in another calculation. Cumulate as part of the calculated item helps, but would require to have already the correct mathematical sign for all your values, so that it can be simply summed up.
Hello @oliverlee,
thank you so much for your answer.
So the average I created is not an average with in the metric, rather it is (ex.) the metric Revenue with dimensions ( PnL lines, country, month), divided by number of active consumers (dimensions here are country, month).
I created a new dimension called version which is the revenue either as a total or avg per persona. Along with your suggestion i then made “version” single select and added it to the pages section of the pivot. So now it is possible to switch between the views.
But if i have them both then the one will show up after the other.
When it comes to calculated items, i tried adding the version dimension to number of personas to be able to divide by, but it doesn’t get that the revenue lines are the same for the two metrics so nothing happens. But it would be nice if I could add a calculated item and have it be by a different metric.
Maybe option 3 could work but unsure how to in a smooth way consolidate all the metrics into one metric. Unless i do it in the import and that would be tricky for us.
Any further help here would be greatly appriciated :)
I managed to solve it.
In using IF statements, the “Version” dimension pops up to column level.
Here is a an example:
IF(Version = Version."Total",
'Amount Total'
,
IF(Version = Version."Avg per person",
'Avg per person' -→ this can also be a calculation like ‘Amount Total’ / ‘cnt Personas’
))
Then in the table pivot, you add version to the columns and it comes out neatly side by side.
Thank you for all your help!