
1. Re: Stacked Bar showing thin line when zero stacked on top of nonzero value.
Dan Huff Mar 14, 2013 11:37 AM (in response to Tony Russo)2 of 2 people found this helpfulTony
It is likely that Tableau is seeing these as Null and plotting these as a 0 due to how Tableau handles Null values by default. If you right click your measure used in the chart, select format, and then click the pane tab, you should see a Special Values section at the bottom. If you change this to Hide (Break Lines), these small lines should disappear.
Hope this helps,
Dan 
2. Re: Stacked Bar showing thin line when zero stacked on top of nonzero value.
Tony Russo Mar 14, 2013 2:11 PM (in response to Dan Huff)Dan 
Thanks for your reply. In my workbook I have calculated fields to look for null values and change them to zeros (mainly used for a datatable. I tried your suggestion, but with no luck.
I've attached a file using the superstore dataset and created two calculated fields almost identical to what I am using in my own work. On this sample dashboard you can see the thin blue line on the orange bars (or thin orange lines on the blue bars if you switch the order via the legend).
Many thanks,
Tony

StackedBarExample.twbx.zip 1.1 MB


3. Re: Stacked Bar showing thin line when zero stacked on top of nonzero value.
Dan Huff Mar 14, 2013 3:26 PM (in response to Tony Russo)Tony
How about doing what I have done in the attached. I have changed your initial calculations to throw NULLs instead of 0s so that the desired results can be achieved on the bar chartno tiny lines for the 0s. I then just created calcs that use these and the IFNULL function to turn the NULLs into 0s for your table.
Does this work?
Dan

StackedBarExample  Dan.zip 1.1 MB


4. Re: Stacked Bar showing thin line when zero stacked on top of nonzero value.
Tony Russo Mar 15, 2013 6:27 AM (in response to Dan Huff)Dan  thanks again. On the drive home I was thinking about how you were probably correct in your first response and needed to test it out. I've always tried to use the same calculation in data tables and charts, so I had a little bit of a mental block in thinking about approaching a solution in the way you did in your second response. I appreciate the discussion and help.
Thanks, Tony

5. Re: Stacked Bar showing thin line when zero stacked on top of nonzero value.
Tony Russo Mar 15, 2013 7:29 AM (in response to Tony Russo)Dan (or anyone else) 
I was further implementing your suggested solution into my work and realized that I have over simplified in my example. I've attached a new file with a better replication of how my calculations are setup.
Basically I am using multiple calculations like the AHonChair, each for a different product, but evaluating across two variables such as category and product. Then I am using another calculation to sum up the 3 individual product calculations and using that calc on the chart/table. (So calcs for Avery48, Avery49, Avery52 are summed together in calc AveryProducts1).
Your latest solution works in eliminating the thin bar, but I am missing something to handle when one of the 3 individual product calcs are null (I get a bar only when there are no null values across each of the 3 "sub calcs").
Any direction is appreciated.
Thanks, Tony

6. Re: Stacked Bar showing thin line when zero stacked on top of nonzero value.
Dan Huff Mar 15, 2013 9:11 AM (in response to Tony Russo)Tony
Have you tried wrapping the pieces of your aggregate calculations with ZN():
zn(sum(First Measure)) + zn(sum(Second measure))
This may solve the issue. It does not really make sense to add a nonNULL value to one that is NULL. This ZN simply treats those NULLs as 0s so that you can add the nonNULL value within the formula even if a NULL exists in another part.
Hope this helps,
Dan

7. Re: Stacked Bar showing thin line when zero stacked on top of nonzero value.
Tony Russo Mar 15, 2013 10:50 AM (in response to Dan Huff)I have been trying a variety of ways to wrap the ZN() with no luck.
Thanks, Tony

8. Re: Stacked Bar showing thin line when zero stacked on top of nonzero value.
Tony Russo Mar 18, 2013 6:56 AM (in response to Tony Russo)Is there another way I should approach this problem? Was starting to wonder if I am doing the calculations in a way that is not ideal.
Thanks, Tony

9. Re: Stacked Bar showing thin line when zero stacked on top of nonzero value.
Dan Huff Mar 25, 2013 3:05 PM (in response to Tony Russo)Sorry for the massive delay in response Tony. I was out all of last week on vacation without access to a computer.
One thing you could try is the following:
Make your calculations like this:
Calc A  IF Category="A" THEN [Quantity] ELSE 0 END
Calc B  IF Category="B" THEN [Quantity] ELSE 0 END
Calc C  IF Category="C" THEN [Quantity] ELSE 0 END
All Three  sum([Calc A]) + sum([Calc B]) + sum([Calc C])  you can use this on the crosstab view
All Three Null  IF sum([All Three])=0 THEN NULL ELSE sum([All Three]) END  you can use this on the bar chart
This may do the trick. If it does not, it may just end up requiring either the small bars or the NULL values in the table.
Hope this helps,
Dan

10. Re: Stacked Bar showing thin line when zero stacked on top of nonzero value.
Tony Russo Mar 25, 2013 6:44 PM (in response to Dan Huff)Dan  When I apply your "All Three Null" calculation I get the error "Cannot use NULL type in IF expression".
What do you mean by your last sentence?
I really appreciate your help with this.
Thanks, Tony

11. Re: Stacked Bar showing thin line when zero stacked on top of nonzero value.
Dan Huff Mar 26, 2013 9:19 AM (in response to Tony Russo)Man I am just failing all over this. I always forget that we do not like the NULLs in the aggregate statements.
Here is one more idea I have. You could try combining the calcs all at once as I have done in the attached. This allows you to assign the values as NULL so that we don't get the tiny bars on the bar chart. Additionally, this subsequently allows you to format the NULL values on the crosstab to show up as 0s. All you have to do is right click the field on text, click format, and then enter in 0 as the text for NULL values.
Does this solve it? I really must apologize for how inefficient I have been with helping you out on this.
Dan

Possible Solution.zip 1.1 MB


12. Re: Stacked Bar showing thin line when zero stacked on top of nonzero value.
Tony Russo Apr 4, 2013 3:33 PM (in response to Dan Huff)Dan  absolutely no worries on the delay, as I appreciate anyone taking time to help on these forums. I was just now able to get back to the problem myself.
After a little reworking my scenario using your example, I was able to get this to work. No thin lines for null!
Many thanks,
Tony