9 Replies Latest reply on Sep 4, 2018 1:33 PM by Joe Oppelt

# Adding a Subcategory to each other

Hey guys, I have attached an excel document with some test data. I know how to make calculated fields but im wondering if I can do calculation on subcategories. For example In the actual column I want to take the With Actual and divide by the Net Actual amount. Aka I have different accoutns but same column. Is that possible in tableau? All Im getting right now is just finding a difference in 2 columns and not in 1 column different accounts

Numerical example would be Account Net, Campus 1, Actual = 250.8, Account With, Campus 1, Actual = 4. I want 4/250.8 * 100

Thank you!

Best,

Eugene

• ###### 1. Re: Adding a Subcategory to each other

[Campus Net Calc]:

{ FIXED [Campus] : SUM ( if [Account] = "Net] then [Actual] END ) }

Do the same to make [Campus With Calc].

On every row you will get each of those values, and you can do the math for each [Campus].

• ###### 2. Re: Adding a Subcategory to each other

Hi Eugene,

Here it is, You can Take out Actual from Rows to get One Row per Campus

Thanks

Deepak

If It Helps, Pl mark it Helpful and CORRECT to Close Thread

• ###### 3. Re: Adding a Subcategory to each other

Hey Guys, I know the Fixed thing is a LOD calculation. If I am understanding it, FIXED Campus means that for every campus, check the next parameter and give me a number? So it is saying Check Campus 1, If account = Net return X if Account = With return y, thats why I can do the calculation of x/y * 100 and I get the right info. Is that correct?

I tried both ways btw and they both work!

• ###### 4. Re: Adding a Subcategory to each other

Yes Correct

• ###### 5. Re: Adding a Subcategory to each other

Exactly.  Understand too, even though your sample data doesn't show this, if you have multiple rows of "Net" for a given campus, the LOD will add them all together for that one campus.

• ###### 6. Re: Adding a Subcategory to each other

Got it! Thank you very much. Is there a good LOD Learning center I can look at? It seems like its a very powerful tool that I haven't had a chance to experience yet.

• ###### 7. Re: Adding a Subcategory to each other

I also have 1 more question. Now that I have that made. I made a top 5 and bottom 5 filter. Is there a way I can sort the table dynamically. For example top 5 = sory by ascending, and bottom 5 sort by descending. I am using parameters and a calculated field that does sum of actual or -sum of actual depending on the user parameter input.

• ###### 9. Re: Adding a Subcategory to each other

To sort by a table calc (which is what RANK is) you have to put that pill as the first pill on ROWS (or maybe COLUMNS depending on what you are doing) as a DISCRETE pill.

You can see examples of that in lots of links out there.  Here is one:

What you are describing regarding top-N or bottom-N could be done with two calcs -- one sorting ascending, and the other descending.  Then you would have a [Sort order] calc that would use the ascending calc or the descending calc based on what the user selected.  It would be your [Sort Orderr] calc that you would put on ROWS as shown in the link I provided above.