4 Replies Latest reply on Aug 22, 2018 9:31 PM by Zhouyi Zhang

# Total Sum calculation based on a dimension

How to calculate Total Sum of all values in a column based on a Dimension. I need to sum up all values separately by using a dimension.While doing sum I need to ignore negative values. How to do it in Tableau. In the attached file I need to create separate view based on user and need to show up Total time, Misc time,page cnt and code cnt columns in a single row.  • ###### 1. Re: Total Sum calculation based on a dimension

Hi, Sunny P

Please find my solution attached as well as below screenshot Hope this helps

ZZ

• ###### 2. Re: Total Sum calculation based on a dimension

How to avoid Negative values in Misc Time column? I am getting negative values if I add whole data

• ###### 3. Re: Total Sum calculation based on a dimension

Sunny,

You can use below formula to avoid negative values

if misc time is >0 then misc time else 0 end

use this field to get the total sum.

Hope this helps.

Thanks,

Ankit Bansal

• ###### 4. Re: Total Sum calculation based on a dimension

Hi, Sunny

You can create a calculation for misc time like

Sum(if [Misc time] < 0 then 0 else [<osc time] end)

and replace it in the measures.

ZZ