AYUSH KUMAR
AYUSH KUMAR

Reputation: 11

Tableau Calculated field (can't mix aggregate - non aggregate functions)

Promo on This Sku contains an aggregate of promos applicable on the Skus and I was using this below code for calculated field to find Promo Net Sales wherever the my Promo ID (Sls Prmo ID) has been applied. But it says an error "can't mix aggregate and non-aggregate arguments with this function"

Example Promo on This Sku: p1,p2,p3 and I want p3 sales only so my Sls promo id would be p3 here

Code:

IF CONTAINS([Promos On This Sku],ATTR(STR([Sls Prmo Id]))) then STR(SUM([Promo Net Sls])) ELSE STR(0) END

Upvotes: 0

Views: 183

Answers (1)

Andy TAR Sols
Andy TAR Sols

Reputation: 1735

Without knowing the formula behind [Promos On This Sku], which could make my suggestion a non-starter, you can try altering your formula to:

SUM(IF CONTAINS([Promos On This Sku],[Sls Prmo Id]) then [Promo Net Sls] END)

You could wrap that in STR if it's important to return this as a string

Upvotes: 1

Related Questions