10 Replies Latest reply on Mar 15, 2019 11:19 AM by jon rios

# How to show up/down arrow (shape) based on trend?

Hello!

I'm trying to create a "ticker" that resembles a stock ticker that shows a percent difference between Current Volume YTD compared to 2012 Volume YTD. I have the percentage working correctly, but I'd love to have an arrow out beside the percentage that changes based on whether we are trending up or down. The up trend would be a green arrow and the down would be a red arrow.

You can see what I've done with the attached workbook (I'm working in V8 Beta.) In the upper left of the "Branch Dashboard" is where you will find the ticker I'm referring to. Currently I have a static image showing there to mock up the way I want it to function (this is a floating object so it may not appear correctly to those not in Beta8). Is there a way to change the image being shown to a red arrow when the number goes negative?

Thanks,

John

• ###### 1. Re: How to show up/down arrow (shape) based on trend?

John,

If you create a calculated field that gives you a discrete result for up/down/no change, then you can put that field on the shape shelf and assign a different shape for each result.

The code for the calculated field would look something like:

IF [Calculation1] > 0 THEN "Up"

ELSEIF [Calculation1] = 0 THEN "No Change"

ELSEIF [Calculation1] < 0 THEN "Down"

END

Then you would give "Up" and up arrow, "Down" a down arrow, and some other shape for "No Change".

Regards,

Joshua

1 of 1 people found this helpful
• ###### 2. Re: How to show up/down arrow (shape) based on trend?

Joshua,

The logic makes sense. How do I assign the up arrow to the "up" value?

• ###### 3. Re: How to show up/down arrow (shape) based on trend?

John,

• ###### 4. Re: How to show up/down arrow (shape) based on trend?

John,

The trick is that you have to have that value present in the current view before Tableau knows to let you assign a shape.  There are a couple of ways you could do this.  One is to get the data to a point (through filtering, parameters, etc...) that the value changes from negative to positive.  Then you can assign the up arrow.

The easier way might be to just temporarily adjust your calculated field three times to hard code the value and assign the shape each time.

1. Change the code to

"Up"

3. Change the code to

"Down"

4. Assign down arrow

5. Change the code to

"No Change"

6. Assign whatever shape you want for this.

7. Change the code back to

IF [Calculation1] > 0 THEN "Up"

ELSEIF [Calculation1] = 0 THEN "No Change"

ELSEIF [Calculation1] < 0 THEN "Down"

END

2 of 3 people found this helpful
• ###### 5. Re: How to show up/down arrow (shape) based on trend?

I'd love to hear a short-cut too!

• ###### 6. Re: How to show up/down arrow (shape) based on trend?

I don't know of any, I usually do something like what Joshua or Shawn do - play with quick filters first to see if I can get the values, then manipulate the calculated fields.

Jonathan

• ###### 7. Re: How to show up/down arrow (shape) based on trend?

Thanks to everyone for the help!

It was easier in my brain to alter the data source (add a dummy data value in the field being calculated that exceeds the 0% threshold and then one that falls short of it). This allowed the different shape values to appear in the Shape Shelf.

I appreciate everyone's assistance. You guys rock! As a noob to Tableau, I can honestly say I've been blown away with the assistance given via the community.

Thanks again,

John

• ###### 8. Re: How to show up/down arrow (shape) based on trend?

How could you indicate a different shape for 0% change?

• ###### 9. Re: How to show up/down arrow (shape) based on trend?

You can just take the sign of the field and drop it to shapes as discrete.

Calculated Field = SIGN(Trend Value)

That's the shortest way I found

• ###### 10. Re: How to show up/down arrow (shape) based on trend?

im dealing with this now. its shocking that this is still the case for KPI arrows and colors... isnt this the basis of reporting and visualization??