Reputation: 423
I have a date field which is a calculated field ("SalesDate_current_month", this will give values True or False) from original date column (SalesDate). Trying to create a calculated field as below, but getting this error "Cannot mix aggregate and non-aggregate comparisons or results in 'If' expressions
".
IF[SalesDate_current_month] = True then SUM([Sales])/SUM([Employees_Per_Region]) END
Can anyone help me in this?
Upvotes: 0
Views: 62
Reputation: 3348
Either use ATTR to make SalesDate_current_month an aggregate or wrap the sum around the numerator and denominator.
IF ATTR([SalesDate_current_month]) = True then SUM([Sales])/SUM([Employees_Per_Region]) END
or
SUM(IF [SalesDate_current_month] = True then [Sales] end) /
SUM(IF [SalesDate_current_month] = True then [Employees_Per_Region] end)
Upvotes: 3