0
votes

I am trying to add a calculated field in my Data Source connection. If column 'Order Status' is not equal to 'Shipped' then give the sum of the 'Carton Count' else return 0.

This is what I tried and not sure why it won't let me use this.

IF([Order Status]) != 'Shipped'
THEN SUM([Carton Count])
ELSE 0
END
1

1 Answers

2
votes

Tableau doesn't work in a traditional way where we aggregate the the measures in a formula, tableau doesn't allow you to aggregate in a calculated field instead you take measures as it is and use aggreagation at sheet level.

So your formula will be like:

IF([Order Status]) != 'Shipped'
THEN [Carton Count]
ELSE 0
END

When you drag this field on to sheet then aggregation is applied automatically