10 Replies Latest reply on Dec 12, 2019 4:59 PM by HongKai Chen

# How to sum different columns

Dear all,

I practice Tableau, there is some question need help.

I think it may calculation by LOD, but I not proficient this function.

Like this image, we want sum value in different team and type.

Dose any idea to calculation this, please let us know.

Very thanks.

HK

• ###### 1. Re: How to sum different columns

Greetings,

You need to seperate your results in 3 different measures.

• ###### 2. Re: How to sum different columns

Hi HongKai,

Yes, you are absolutely right this problem can be solved using the Fixed function.

Please refer the formulas for the fields.

Result A:

sum({ FIXED  [mONTH], [Calculation1]:

ZN(sum(if [agency EN] = "A Team" and [#Data Source] = "Type A" then [Count of measure value] end))})

+

sum({ FIXED [mONTH], [Calculation1] :

ZN(sum(if [agency EN] = "B Team"  then [Count of measure value] end))})

Result B:

sum({ FIXED  [mONTH], [Calculation1]:

ZN(sum(if [agency EN] = "A Team" and [#Data Source] = "Type B" then [Count of measure value] end))})

Result C:

sum({ FIXED  [mONTH], [Calculation1]:

ZN(sum(if [agency EN] = "A Team" and [#Data Source] = "Type C" then [Count of measure value] end))})

Thanks,

Shruten

1 of 1 people found this helpful
• ###### 3. Re: How to sum different columns

Hi Shruten,

Let me try it more.

• ###### 4. Re: How to sum different columns

Hi Sander, Thanks for your help! this method is intuition that I can know! thanks again!

• ###### 5. Re: How to sum different columns

Glad I could help Honkai Chen.

• ###### 6. Re: How to sum different columns

Hi Sander,

It's very thanks for your help.

We have similar question...need your help.

If we want calculation different value how to calculation this?

like this example, sometimes we will calculate "Count of measure_value"and sometime "countd UID".

If we want calculate UID, then I think want change calculated filed.

That very complicated, dose any way to change value quickly?

Maybe made Result A,B,C is Dimensions, and "UID, measure value" as measures, then we can easy to change.

Wish you can help us again...

very thanks.

HK

• ###### 7. Re: How to sum different columns

Greetings,

Can you give me an example when you want to calculate measure value and when you want to countd UID then i can create a calculation based on your example.

• ###### 8. Re: How to sum different columns

Hi Sander,

I think good result is like this image, follow this criteria and calculation by UID, measure value or other value.

there is our simple data source(new source).

HK

• ###### 9. Re: How to sum different columns

Greetings,

I understand the situation, your new source has some changes in there which makes it very difficult to adjust the calculation, for example you changed the names but also instead of 'Type B' you now have 'GP920' and 'Team B' instead of 'B Team'.

It is still possible to adjust the calculation but then we need to change a bit more than usual. I would advise you to keep using the same names as much as possible

I made the assumption that Type B = GP920

Another thing is that since this count of userID is not in the data but a field in tableau you have to aggregrate the other equations as well. On top of that month and year of test date does not work so you have to take test date field itself.

Lastly, in the previous example month and year were by coincedence operating on the deepest level of detail because Datasource and Agency EN combined are the deepest level, so you have to include this in your LOD calculation.

• ###### 10. Re: How to sum different columns

Hi Sander,