9 Replies Latest reply on Nov 29, 2018 6:18 AM by morton hsiao

# math on Subtotals

I figured out how to do subtotals on only a few dimensions, but now i'd like to do math on them.  I bet there's a sneaky window function of some sort.  this is my data:

This is what I'd like:

I figured out the selective subtotal

But now how do I make the divisions?

• ###### 1. Re: math on Subtotals

Like This?

Thanks

Deepak

If It Helps, Pl Mark It Helpful and CORRECT to Close Thread

1 of 1 people found this helpful
• ###### 2. Re: math on Subtotals

Hey Morton,

Tableau is not the most flexible tool for creating tables - have you considered a more visual approach?

-Chris Chalmers

• ###### 3. Re: math on Subtotals

Holy God, you did it but its an incredible solution.  I'm trying to figure it out but I need step by step instruction, I'm sure.  It looks like you duplicated the table.  My real table is 3Gb.  I think I'm better off implementing the solution in sql, but the drill down will be difficult.  I also actually have 4 layers, I thought I'd just be able to address the aggregate values in the table like you would crystal reports.  Anyway, can you tell me how you duplicated the data in tableau?

• ###### 4. Re: math on Subtotals

I self Unioned Data which gave me one more additional column called Table Name to Manipulate the way u wanted. If You got the Solution, You maty Close Thread by marking my Reply as CORRECT to close Thread

• ###### 5. Re: math on Subtotals

One last question.  You got the AGG(Final) metric.  How do I format a and b to be "0.0" and a/b to be "0.0%"

• ###### 6. Re: math on Subtotals

Here it iS:

Thanks

Deepak

Pl Close The Thread by Marking my Reply as Helpful and CORRECT to help Others.

1 of 1 people found this helpful
• ###### 7. Re: math on Subtotals

I'm amazed by the tricks you're pulling to do basic things in Excel.  I got one last one.  How do I add the comma.  I googled a disappointing vote and learned there isn't just a .format(<str>,format) function like every other report writer or computer programmer.  I think tableau purposely dumbs down their table making facilities to just make it easy to debug graphs because they don't want to compete directly against power bi or excel.  makes it easier for them to one day get acquired by the biggest software company on earth.

• ###### 8. Re: math on Subtotals

Well, I think You can Manipulate the Calculations I created and get the necessary Formatting and Close THis tHread to Help Others by Marking my Reply as Helpful and CORRECT as Your Initial Question has been Answered. For additional Questions, you may create new Threads.

Thanks

Deepak

• ###### 9. Re: math on Subtotals

Yes, you did the very best a man can do.  Unbelievable acrobatics for something so simple