8 Replies Latest reply on Sep 16, 2019 8:10 AM by Don Wise

# Help.....Subtotal not coming out correctly.

Hi Everyone,

I really need help with the following report. See screenshot and attachment. I have 4 columns named C&D Avg, Production Avg, RVD Avg & Transition Avg. Each of these columns is made up of combination of the column A, B, C, & D.

For example, column C&D Avg calculation is:

IF ATTR([Phase]) = 'C&D'

THEN

AVG([B] + [C] +[D]) / 3

END

Column RVD Avg calculation would be:

IF ATTR([Phase]) = 'RVD'

THEN AVG([A] + [B] + [C]) / 3

END

Sum of All 4 Phases calculation is:

[C&D Avg]  + [RVD Avg] + [Production Avg] + [Transition Avg]

As you can see on the screenshot, the Total & Grand Total aren't showing any value on these 5 columns. Do you know why Tableau isn't pulling any value on the Total/Grand Total row?

How can i fix this?

Thank you.

• ###### 1. Re: Help.....Subtotal not coming out correctly.

Hi, Edmond

Is it something like this? I just modify the C&D as exmple

Workbook attached.

Hope this helps

ZZ

1 of 1 people found this helpful
• ###### 2. Re: Help.....Subtotal not coming out correctly.

Hi Zhouyi Zhang,

Thanks for your help.  Your calculation works.  But how do i get the column named Sum of All 4 Phases to show values from the 4 columns with the average of these 4 values displayed in the Total row?

Screenshot shows you what I'm looking for.  I've also attached the updated tableau report here.

Thank you.

• ###### 3. Re: Help.....Subtotal not coming out correctly.

Hi, Edmond

Hope this helps

If this solves your question, please don't forget to mark my answer as either helpful or correct to close the thread. thx.

ZZ

2 of 2 people found this helpful
• ###### 4. Re: Help.....Subtotal not coming out correctly.

Thank you, Zhouyi.  You're a genius.

• ###### 5. Re: Help.....Subtotal not coming out correctly.

Hi Zhouyi,

I just realized that the Grand Total isn't coming out correctly. See screenshot.  The correct number is 7.46836.  But Tableau is showing 7.65270.  Not sure what I'm missing.

The formula of Grand Total should be (Total of Project A + Total of Project B + Total of Project C + Total of Project D) / 4.

Thanks.

• ###### 6. Re: Help.....Subtotal not coming out correctly.

Hi Zhouyi,

I ran into another problem.  I applied the same formula to other group of columns to get the average, the numbers don't come out correctly.  Can't figure out why.

Can you help?

See attachment.  Thank you.

• ###### 7. Re: Help.....Subtotal not coming out correctly.

Hi, Edmond

Can you tell where is t he problem? and what should the correct figure be?

ZZ

• ###### 8. Re: Help.....Subtotal not coming out correctly.

Hi ZZ,

This appears to be a duplicate post, under a different thread: If-then-else Average not working. We'll have to wait and see what the response(s) are!  Best, Don