12 Replies Latest reply on Apr 22, 2018 11:17 PM by SUMIT Goyal

I cant seem to figure this out for find an answer! I know it has to be simple. In a crosstab, I would like to create a column calculating the difference between 2 other columns. Basically, Difference = Period 2 - Period 1. Can someone please help!? Period 1 and Period 2 are a subset of a Period dimension. Can anyone advise? Thank you!

Hi Arturo,

Just dump the calculations inside a new calculated field - in pseudocode;

[Period 1] - [Period 2]

If that doesn't work, try wrapping them in sum([Period 1])

HTH

Peter

Thanks, Peter.

I have tried that. The calculation box doesn't recognize Period 1 or Period 2 as they are not measures. They are dimensions.

Ahh - I thought you had already converted them into calculated fields.

Just before the step I noted above, create 2 calculated fields along these lines;

if [Period] = "Period 1" then [insert the measure you want to calculate] END

HTH

Peter

Hmm ok. I have 10 measures I need to calculate a difference for, each of a summed value of another dimension. Do I need to go in create a new field for all of them? Your help is much appreciated, I am just learning Tableau.

Hi Arturo,

If you upload a sample dataset we might be able to pivot this into a single measure for you, but I'm working with what I can see on the screen here.

There are other options available as well, but creating a new field for each measure will work.

HTH

Peter

Peter,

Attached is what my data effectively looks like.

Arturo

Hi Arturo Cruz,

To calculate the difference between period 2-period 1, I am using Quick table calculation --> difference on measures.

Also I am attaching a sample workbook for your reference. Please note I used Tableau 10.4.1 desktop for creating this workbook, to open it you need 10.4.1 or later version

Thanks,

Karthik

Thank you for your help! Do you know how I can get those difference values in a third column rather than the 2nd column? I would like for the tables to look something like this

Arturo

Hey, did u figure it out? I have the same problem and its so hard to find on the internet.

Thanks

Hi Arturo,

I'm jumping on this thread mainly to stress

the importance of using the right tool for the job.

Stating the obvious -- that Tableau is not Excel (and vice versa) --

wouldn't be enough for an answer, so i've mocked up an example of

how inefficient and sometimes overly complicated it would be to emulate

a Cell-based logic of Excel in Tableau (which is mainly a Set-based tool).

Hope it could help.

Yours,

Yuri

Hi Arturo,

Please see attached workbook (v10.5) using your sample data.  It requires a pivot of two of your data columns (Expense, Revenue, in order to work.  It's as close as I could get to your requirement.  I agree with Yuriy Fal though, Tableau really wasn't meant to mimic MS-Excel or vice-versa.  Below are the screenshots showing the steps and attached is the sample workbook.  Hope it helps you get where you need to be.  Thx, Don

1 of 1 people found this helpful