Basic Table Question
Submitted by Rdub on March 12th, 2010
Rdub
Posts: 8
Joined: March, 2010
I am trying to set up a simple table crosstab and am trying to determine the best way to do this. I am using "add table calculation" but I can't seem to be able to get all the columns to show. Any suggestions?
Thank you. Example below:
Category A Category B Difference % Difference
Number of Records 10 15 5 50%
Comments
James Baker
Posts: 2175
Joined: December, 2007
If you can't "get all the columns to show" because it won't let you add duplicate measures to a Measure Names shelf, create the table calc first and *then* add the original column again.
Another difficulty might be "trying to use table calcs to perform a calculation on only some of the columns". If I'm reading your example correctly, you might want to try creating a couple calculated fields. One would be "[Category B] - [Category A]" for "Difference", and then "[Difference] / [Category A]" for "% Difference" (and give it a default number formatting of percent).
Rdub
Posts: 8
Joined: March, 2010
James,
Thank you for your reply. I think my question is a lot more basic. I have 5x2 crosstab. I want to compute two more columns for this. One is the difference between the first two columns, and the other is the pct difference. This is very easy to do in Excel, but seems to take work in Tableau. I have attached the workbook. I cannot seem to set up these calculations.
James Baker
Posts: 2175
Joined: December, 2007
You can compute new columns by right-clicking measures pane and selecting "Create Calculated Field". The formulas I gave above would be the contents of the two calculated fields you want to make. Are there any particular difficulties/snags in doing this?
Rdub
Posts: 8
Joined: March, 2010
I'm not sure how I would do this in a calculated field. I'm taking the difference of the same variables. What would the syntax be? I tried doing it in a table calculation and that worked, but I can't figure out how to perform multiple calculations on the same data. I want to end up with a 5x4 crosstab which contains the two original compared values, + 2 more columns for the difference and the pct difference.
Thanks for your help.
Post new comment