8 Replies Latest reply on May 20, 2016 4:10 AM by Andrew Watson

# Performing operation between two columns of a table and displaying in third one

Hi,

I have created a table in Tableau. It looks like:

Name        COUNTD(Count1)      CountD(Count2)

Abc                 10                                            20

Def                 30                                             40

Pqr                 50                                             60

Both Count1 and Count2 are calculated fields

I want to sum these both column values and display the sum in new column as mentioned below:

Name        COUNTD(Count1)      COUNTD(Count2)               Total Count

Abc                 10                                            20                         30

Def                 30                                             40                         70

Pqr                 50                                             60                         110

Is there any way in which I can create the calculated field "Total Count" with formula Column2+Column3 because I do not want to do the distinct count again for both the counts.

Please help.

Thanks,

Palak

• ###### 1. Re: Performing operation between two columns of a table and displaying in third one

Hi Palak,

Have you tried creating a calculated field that adds your two measures?  That seems like the most logical solution.

Good luck,
Ivan

• ###### 2. Re: Performing operation between two columns of a table and displaying in third one

As I mentioned, I am doing COUNTD for my calculated field. My calculated field i.e. Count1 and Count2 return me multiple records.

Therefore, I dont have the values to be added, directly in measure name.

• ###### 3. Re: Performing operation between two columns of a table and displaying in third one

Ivan's suggestion sounds sensible:

Create a calculated field with this formula: COUNTD(Count1) + COUNTD(Count2)

• ###### 4. Re: Performing operation between two columns of a table and displaying in third one

If it doesn't work please supply some sample data with expected output to add some context.

• ###### 5. Re: Performing operation between two columns of a table and displaying in third one

Hi,

I don't want the COUNTD to be performed again. That is why I am looking for something where I can read the already computed values form the table. I want read the whole column directly.

• ###### 6. Re: Performing operation between two columns of a table and displaying in third one

Create 2 calculated fields with, one with the formula COUNTD(Count1)  and the other with the formula COUNTD(Count2).

Create a 3rd calculated field: [CalcField1] + [CalcField2]

• ###### 7. Re: Performing operation between two columns of a table and displaying in third one

But this will do all the calculations again.

• ###### 8. Re: Performing operation between two columns of a table and displaying in third one

:-)

If you want a calculation based on the results of another calculation then you need to do all of the calculations required.