3 Replies Latest reply on Jan 19, 2019 5:45 AM by Cristian Saavedra

# drill down and up issue - totals are wrong

Hi Tableau geeks, I have an issue when I drill up my calculations. At the lowest level "C Nr" the total sum is correct.

The hierarchy is:

Mitarbeiter->Renr->Bestellgruppe->C Nr

But when I collapse it to the higher level "Bestellgruppe" suddenly the totals are getting wrong even for each row.

These are my formulars.

field Berechnung4:

if sum([I Id Best])=206 // condition if Bestellgruppe is "supplies"

then sum([stored_value])   //stored value is a database field

else  (new calculation)

end

new calculation:

(sum([sales]) - sum([purchase]) + sum([customer_shipping]) - sum([company_shipping]))*0,085  //all fields are in the database.

I can't give you a work book because I'm not able to recontruct the different joins of the company live system.

Is this possible that it happens because of a lot joins or is this a hierarchy issue?

Thanks for any information.

• ###### 1. Re: drill down and up issue - totals are wrong

HI Patrick,

I don't think that have something to do with the Joins, It is difficult to give you a help without an example of some data to understand the problem but my guess is that the problem is related with the SUM([I Id Best]) = 206

I think that this field should be a dimension and because of that is a mistake do a sum, if you had partially another that in the sum are equal than the ID then you are adding to the total example one of 100 and another of 106 of other categories.

Instead try to use ATTR (https://kb.tableau.com/articles/howto/when-to-use-the-attribute-attr-function)

Or use the String IF ([Bestellgroup] = "Supplies")

I hope that help you with that.

Happy Viz

• ###### 2. Re: drill down and up issue - totals are wrong

I tried to reconstruct this behaviour in an example workbook but there everything works fine, that's why I didn't attached anything. If I use a dimension instead of sum([I Id Best]) = 206 I'll get an error that non aggregated and aggregated fields can't be mixed because "new calculation" is an aggregate. May be I could use INCLUDE?

• ###### 3. Re: drill down and up issue - totals are wrong

Can you try using ATTR, I attached an example: