6 Replies Latest reply on Feb 7, 2012 2:21 PM by dariuskilstein

# Conditional axis based on chosen data

Hi Guys,

I've got a pretty simple question that doesn't seem to be simple to answer.

I've attached 2 screenshots as I cannot upload the workbook

Basically, I have a parameter that controls which data gets displayed on the graph. There are two options:

1) YoY Visits

2) Visits

When YoY Visits is selected, i want the axis to be a %

When Visits is selected, I want the axis to be a full number.

However it seems that the axis can only have one format type (number OR percentage).

Is there a way to conditionally control this axis?

Darius

• ###### 1. Re: Conditional axis based on chosen data

Darius, as long as you're only looking for 2 different number formats, Zach Leber came up with this very clever way to switch the format using the positive/negative custom number format. I couldn't find his original post but I saved his workbook (see attached). It's a little hard to see what's going on at first, here's a shot of the calc field, note the negative signs:

Then he puts this on the label shelf and uses a custom number format:

He's doing % for positive numbers, and normal formatting for negative numbers. One warning: this doesn't work if you have negative values in your data set.

That Zach Leber is a very clever guy! Enjoy his work.

--Shawn

1 of 1 people found this helpful
• ###### 2. Re: Conditional axis based on chosen data

Hey Shawn,

Thanks for the quick response.

This ALMOST helps. The issue with this is that the 2nd type of axis (negative) comes upside down!!!!! I.e. starts at 4,000,000 and the top ends up being 0!

Unfortunately the axis in the example is long-lat. It's not based on the actual metric!

Thanks though - very close try!!!

• ###### 3. Re: Conditional axis based on chosen data

Zach's concept can work in a lot of different situation that have nothing to do with lat-long. Provide samples of your metrics and I'll be glad to show you how to make his concept work. (Assuming none of your data has negative values.)

Cheers,

Shawn

• ###### 4. Re: Conditional axis based on chosen data

Howdy

Hope you can access the data.
D

• ###### 5. Re: Conditional axis based on chosen data

Darius, you're absolutely right this technique doesn't work in your situation. You might be able to set this up as two different sheets and then use dashboard actions to switch between the two. Not sure how the switch will look, haven't tried this myself. Sorry, I couldn't be of more help.

--Shawn

• ###### 6. Re: Conditional axis based on chosen data

Mate no worries - thanks a million for giving it a shot!!!!!!!! Really apreciated.

I have a Tableau open day here in Sydney on Friday so maybe I'll ask them there if I get a chance to speak to someone

Thanks again!
D