Forum Discussion

daniel_t_93_'s avatar
daniel_t_93_
Frequent Visitor
2 years ago
Solved

Calculating averages on row level in table visualisation

Hi,

 

I'm a bit stuck with getting correct averages in a table visual. 

 

My data source (simplified) looks a bit like this:

 

DateChannelPlatformCostTransactionsCost per Transaction
1Paid SearchGoogle10001566.67
1Paid SearchBing500683.33
1Paid SocialMeta7005140.00
1Paid SocialPinterest2500 
1Paid SocialSnapchat1000 
1DirectDirect 20 
1OrganicOrganic 17 
2Paid SearchGoogle12001485.71
2Paid SearchBing600875.00
2Paid SocialMeta7506125.00
2Paid SocialPinterest2001200.00
2Paid SocialSnapchat75175.00
2DirectDirect 18 
2OrganicOrganic 14 

 

Cost per Transaction is calculated as DIVIDE(SUM(Cost)/SUM(Transactions)). This works perfectly fine on row level. 

 

However, when creating a table visual (using average as aggregation), I get this:

ChannelPlatformCostTransactionsCost per Transaction (what I have now)Cost per Transaction (wanted solution)
Paid SearchGoogle22002975.8675.86
Paid SearchBing11001478.5778.57
Paid SocialMeta145011131.82131.82
Paid SocialPinterest4501200.00450.00
Paid SocialSnapchat175175.00175.00
DirectDirect038  
OrganicOrganic031  

 

The first cost per transaction column is what I have now, but that one is incorrect since it doesn't take into account rows where there were cost, but no transactions. What I need is a calculation like the one in the most right column of this example, which calculates the average on row level in the table visualisation. Anyone who can help me out?

1 Reply

  • Still works on all levels, but needs to be a measure.