0
votes

i'm trying to create calculated field in tableau, my query is below:

SUM(IF([Qtr]='2018-Q1' OR [Qtr]='2018-Q2' OR [Qtr]='2018-Q3' OR [Qtr]='2018-Q4')
 THEN FLOAT([Channel Mix]) END) / FLOAT([Revenue])

i'm getting error saying cannot mix agreegate and non agreegate comparison.

Final objective is to divide with revenue column .

Please help

2
try attr() function on Channel Mix or Revenue. One of them is an already aggregated fieldJonathan Lam

2 Answers

1
votes

It appears that your numerator is a sum (an aggregation) but your denominator is not. Try dividing by: / sum(FLOAT([Revenue]))

0
votes

Try this

SUM(IF([Qtr]='2018-Q1' OR [Qtr]='2018-Q2' OR [Qtr]='2018-Q3' OR [Qtr]='2018-Q4') 
 THEN FLOAT([Channel Mix]) END) /SUM(FLOAT([Revenue])