Why can’t I combine some dimensions and metrics?
In Analytics, you may run into an error message saying that an event dimension can’t be combined with a metric calculated for a session dimension. This message may appear when you create a custom report, apply a segment or a filter. What does it mean, and how can you avoid this combination?
An event dimension may be:
- Page URL
- Search keyword
- Goal name
- Or the like
A metric calculated for a session dimension could be:
- Average, sum, or median counted for session time.
- Average, sum, or median counted for events in sessions.
- Average, sum, or median counted for page views in sessions.
- Or the like
If we coupled this type of dimension and metric, we wouldn’t get accurate numbers. It’s because the database stores information in a way that those kinds of metrics in this combination return skewed results. Here’s why.
Piwik PRO stores data in a session table and an event table. It calculates data from a session table when you use only session dimensions in a report, filter or segment. When you use at least one event dimension in a report, filter or segment, then data is calculated from an event table.
Here’s an example of a session table:
|Session ID||Session time||Events in session|
Here’s an example of an event table:
|Page URL||Session time||Session ID|
Now, if we calculate metrics for a session table, we’ve got:
Average session time = (3:00 + 1:00) / 2 = 2:00
Now, if we calculate metrics for an event table, we’ve got:
Average session time for /home = (3:00 + 3:00 + 1:00) / 3 = 2:20
When in truth, the average session time for all visits that included /home is 2 minutes.
An event table stores session data as a context for the event. If a metric for a session dimension were calculated, it would take each session time to the equation and show you skewed data. This is why we decided to block this type of combination. We don’t want you making business decisions based on incorrect metrics values.
Now, what can you do when you see this error message in our app:
- Use a metric calculated for an event dimension like an average time on page.
- Change a segment or filter condition to a session dimension when you want to apply it on a report with a metric calculated for a session dimension.
- Apply a segment or filter to a report where all metrics and dimensions agree.
- Use grouped dimensions instead of average, sum, or median.