2 Replies Latest reply on Oct 28, 2016 4:37 AM by phil.peddle

# Aggregation Issue

Hi All,

I'm very much a Newby with Tableau and I'm having trouble getting my head around how it works (too used to other approaches)

I'm trying to create a  calculation to show a total where a dimension is in a certain range of values, my problem is I can't get it to total up correctly.

so far I have a calculation that creates a flag that looks like

Flag:

IF attr([Activity]) = 'type1' THEN 'W'

ELSEIF  attr([Activity]) = 'type2' THEN 'W'

ELSEIF  attr([Activity]) = 'type3' THEN 'W'

ELSEIF  attr([Activity]) = 'type4' THEN 'W'

ELSEIF  attr([Activity]) = 'type5' THEN 'W'

ELSEIF  attr([Activity]) = 'type6' THEN 'W'

ELSEIF  attr([Activity]) = 'type7' THEN 'U'

ELSEIF  attr([Activity]) = 'type8' THEN 'U'

ELSE 'X'

END

I have another calculation that looks like

IF [Flag] == 'W' THEN total(sum(x)) END

When I try to use the calculated field it only produces a result if I include the activity dimension in the marks shelf, the problem with that is I get the result duplicated multiple times rather than just showing once, if I remove the activity dimension nothing is returned.

Any help appreciated.

• ###### 1. Re: Aggregation Issue

Try this.

total(sum(IF attr([Activity]) = 'type1' or attr([Activity]) = 'type2' or attr([Activity]) = 'type3' or attr([Activity]) = 'type4' or attr([Activity]) = 'type5' or attr([Activity]) = 'type6' then x End))

1 of 1 people found this helpful
• ###### 2. Re: Aggregation Issue

thank you, perfect!