5 Replies Latest reply on Jul 5, 2012 1:52 PM by P Fro

# Compare values of two fields for each row

I'm no good at coding...I'm trying to create a calculated field that will output either "Positive" or "Negative" depending on whether a number is greater or less than 0.

In this case, I have a table with a year as the column. There are 6 Measures listed in 6 different rows. I just want to create a field that I can add as a shape to indicate whether the 2011 value is greater or less than 0, like this:

I'm just not good enough with the functions to know how to do that. I tried Lookup, but that seems to require a specific field, where I want to judge each measure separately and I couldn't find any specific examples of this in the message boards.

• ###### 1. Re: Compare values of two fields for each row

The closest I could get by formatting only. I used the concept of Jonathan Drummey and his great job, that I believe could help you further on your way: http://public.tableausoftware.com/views/conditionalformattingv4/Introduction.

Best,

• ###### 2. Re: Compare values of two fields for each row

Hi,

Is the list of measures you're displaying based on using Measure Names/Measure Values, or is your data shaped differently?

Jonathan

PS: Thanks for the compliment, Vladi!

• ###### 3. Re: Compare values of two fields for each row

Actually, I am using Jonathan's "Shape/Circle/Square Righ-Align" method (which I found extremely helpful, THANKS Jonathan!) so Vladi, I basically got to the point that you are at with your example, but yours looks more clean than mine!

What I think I need to do now is add a field to the "shape" area that would basically be a true/false describing "is the number in question positive or negative?"

Jonathan, in answer to your question (hopefully), I have "Measure Names" in the rows column with those measure names filtered down to only the measure values I want to display.

Hope that helps!

• ###### 4. Re: Compare values of two fields for each row

The problem with using Measure Names/Values is that there is only one Marks card for all measures in use. There are a couple of alternatives, I've outlined both (with instructions) in the attached workbook:

Cheers,

Jonathan

• ###### 5. Re: Compare values of two fields for each row

Wow Jonathan, two great ideas, thank you! Both work the way I would like, so it looks like just a matter of what one is more comfortable with.

And thanks for creating your very informative interactive manual. It has been very helpful.