1 2 Previous Next 25 Replies Latest reply on Jan 15, 2016 6:18 AM by Simon Runc Go to original post
      • 15. Re: Educational Brain Teaser: Bold Single Label on a Header
        Rody Zakovich

        Yup....I just crashed Tableau.....Learned some interesting stuff though.....


        I think I will settle for the 'Major Axis Tick Marks' under the header.



        1 of 1 people found this helpful
        • 16. Re: Educational Brain Teaser: Bold Single Label on a Header
          Simon Runc

          ...Hat's off Yurij...you've taken the challenge to a whole new level!! - now I see why it had to be v9.2! - that is some pretty lateral thinking there!!


          ...I'll do my best to explain how you did this in the final solution!...might take a few pages!


          This has certainly given me a lot of 'food for thought' on what's possible!! Many Thanks

          • 17. Re: Educational Brain Teaser: Bold Single Label on a Header
            Simon Runc

            Nice one Mark...I hadn't thought of using Gannt Marks to zero to mimic the Bar Mark, and very elegant with the labels...whatever filtering takes place they will always be next to the Bars...Nice!


            ...yet more 'Food for thought'!!

            • 18. Re: Educational Brain Teaser: Bold Single Label on a Header
              Rody Zakovich

              Yes, thank you Yuri Fal


              I wish we could manipulate Pane Labels via Parameters. Would give a lot of flexibility to some really unique stuff.


              Or, better yet, just allow us to conditional format headers.........




              1 of 1 people found this helpful
              • 19. Re: Educational Brain Teaser: Bold Single Label on a Header
                Simon Runc

                ...so looks like this has been a fun challenge and, as always, with Tableau there are several ways we can go about this...several of which I hadn't even considered, so have learned a few things myself!


                The solutions fall into 3 main types. Dual Axis with a 'Fake Axis' for the headers, Using 2 sheets and a dashboard, or Yuri's solution using 'Fake' sub-totals.


                Dual Axis Method

                This is the solution I used, where the challenge was to see Tableau as a 'drawing' canvas, and that 'Text' marks are a mark-type like any other (and so are subject to the same dynamic control)


                So in order to be able to treat the values differently, we need to have them as 'marks' and not as a headers. So we create 2 calculated fields for the Country Label Marks...btw I've also created a parameter so we can switch the Bold Country [Country to Bold]


                [Country = Bold]

                IIF([Country] = [Country to Bold],[Country],Null)




                [Country != Bold]

                iif([Country] != [Country to Bold],[Country], Null)


                This means that for the 1st formula only the country we want in bold is returned (Else NULL), and vise-versa for the second. As Tableau doesn't (well can't!!) plot NULLs, we can place these side by side (as a Text Mark) and Bold one and not the other.

                We drag these onto the Label Mark, and edit the Text as per the below


                Now in order to use them as Marks, and have them in a single Row, we need to create a formula (that will act as an Axis) but have the same value for each country. There are several ways to do this, but I've gone for the following formula (I've used a Table Calc, but as Pooja points out an LoD would do the trick too)

                [Sales Fake Axis_TC]



                and set this up to compute 'Table Down'. This takes the MAX value for any country (the extent of the longest bar), takes 1% of that value and makes it negative. The advantage of this over 'hard coding' a value is that it will stand up to filtering, as the position of the Labels will change if countries are filtered out. We drag this field onto the Column Shelf (make the Mark Type Text) and set up the labels as shown above. The below image shows this, and then when we Dual Axis (Sync Axis) then (and hide the top Axis)



                The final bit of polish...courtesy of Rody!...was that we'd have negative values on the Axis, under the Labels. To get around this we can use the Custom Format setting for the Axis to not show negative number


                Unfortunately for the OP, we have since found out that he does have negative values in his 'real' world solution, so can't use this trick!...sorry Philip Tonge


                As an alternative to this method...and I actually think is more elegant and doesn't require any Table Calcs or LoDs is Mark's use of Gantt marks. This solution is in the 'Using Dual Axis_Gantt Marks' tab. The Labeling trick is the same as above, but by using 2 (Zero) Axis, and Sizing the Gantt marks on Sales, we get the effect of Bars, and we can add the Labels to one Axis, and the Sales Value Label to the other. This again stands up to filtering as the Labels are always to the left of the Zero Gannt...very Nice!


                Using 2 sheets and a dashboard

                So with this method, we create 2 sheets, one for the headers and one for the Bars and place them side by side in a dashboard container. The 2 sheets are set up as follows...I've added in a MIN(1) Axis for the Labels, so they line up in the dashboard


                We then place these side by side, do a bit of resizing/formatting and voila (if you use this make sure any sorting/filtering on country is the same for both sheets!)

                This one has the advantage of being simple, we have no Axis-remnants under the Headers, and stands up to filtering. However if there were enough countries so the Viz would need to scroll, this wouldn't work.


                Yuri's solution using 'Fake' Sub-totals.

                So onto the final solution (which I'll do my best to explain!!), which thinks about the challenge in a totally different way! The thinking here is what else (apart from Label Marks) allow Headers to have different formatting?...the answer - we are able to Bold Totals separately from the Rows...so if we can make the Bold country a Sub-total we can bold it, while keeping the other countries un-bolded!


                First create a formula to create a dimension, to allow us to create Sub-totals at the levels we want.

                [Country <=> Portugal]

                if     [Country] < 'Portugal' then 1

                elseif [Country] = 'Portugal' then 2

                elseif [Country] > 'Portugal' then 3



                This has the below effect, and then when we add subtotals the image to the right shows this. Yuri has also taken advantage here of the new 9.2 feature of showing Totals/Sub-totals at the top

                and then we can hide the 2


                Now as we are using Subtotals, we need to change the formula for SUM Sales, so that the Sub-total actually reflects the sale for Portugal, and the other countries their sales


                [Sales Portugal]

                if     min([Country]) != max([Country]) AND min([Country]) != 'Austria'

                then   sum(

                {exclude [Country <=> Portugal], [Country] : sum(if [Country <=> Portugal] = 2 then [Sales] end) })

                elseif min([Country]) != max([Country]) AND min([Country]) = 'Austria'

                then   Null

                else   sum([Sales])



                The way this min([Country]) != max([Country]) works is much better explained here Customizing Grand Totals – Part 2 | Drawing with Numbers (look at the Customizing Grand Totals with MIN() and MAX() part)...btw if you haven't already I'd advise reading all 3 parts of this excellent post!...In short IF min([Country]) != max([Country])  is True you are in a 'regular' row, else the formula being enacted is on the Sub-Total/Grand-Total section.


                So we drag this field for our Bars.


                Next to get the Sub-Totals to read 'Portugal' we change it's display name here

                and as this will also generate a Sub-Total called 'Portugal' at the top, Yuri's formula (for Sales) returns NULL for that Sub-total, and then he has set the NULL display to '<=====|This is the name of my country here'

                The advantage of this method, is that it stands up to filtering (as long as Portugal isn't filtered!), and as it's using 'proper' Blue Pill headers the formatting/spacing is perfect...the only disadvantage is that we can't dynamically switch the Bold country (in fact we can do in all but the 'hard coded' nature of the Sub-total display being 'Portugal'). For the OP, they wanted 'Their Company' bolded, so this solution is probably the best. As Rody points out, being able to use Parameters in these labels would open up a lot of options.


                ...I think that's everything...Yuri Fal please let me know if I've missed anything (must say, un-picking this was a lot of fun too)


                ...and that it! - poor old Paint.net has been put through it's paces here too!!


                Attached, in 9.2, is a .twbx showing all the solutions detailed above.

                2 of 2 people found this helpful
                • 20. Re: Educational Brain Teaser: Bold Single Label on a Header
                  Yuriy Fal

                  Thank you Simon, for a very thorough explanation

                  of my rough-edged "Subtotal" solution --

                  couldn't explain it better myself!




                  1 of 1 people found this helpful
                  • 21. Re: Educational Brain Teaser: Bold Single Label on a Header
                    Rody Zakovich

                    Thanks Simon for the Brain Teaser.


                    It was a good challenge, and showed, once again, that we can come up with similar end results, using various methods.


                    I think it was also an excellent example of how (With a good foundation of Tableau's mechanics) we can use imagination to manipulate (Or Hack) Tableau to do some really cool stuff.


                    Best regards,


                    • 22. Re: Educational Brain Teaser: Bold Single Label on a Header
                      Simon Runc

                      excellent example of how (With a good foundation of Tableau's mechanics) we can use imagination to manipulate (Or Hack) Tableau to do some really cool stuff

                      ...So true.


                      This is, IMHO, what sets Tableau apart from other Visualisation Tools...rather than have a 'button' for Bar Charts, another from Line Charts...All Vizes are built up from a consistent combination of Marks, Position, Colours...etc. and follows the same set of rules for every Viz type (eg. Blue/Green Pills). As such you are only really restricted by your imagination on how to combine these rules to get to your end goal. This means from a relatively (relative to what the software can do, and compared with its peers) small things to remember we can create almost any Viz. This keeps the tool (from a Technical perspective...'Order of Operations' not withstanding!!) simple and consistent...and has the lovely side effect (by using your imagination, rather than lots of buttons/features/options/plug-ins/libraries...etc.) of being really fun to use.

                      1 of 1 people found this helpful
                      • 23. Re: Educational Brain Teaser: Bold Single Label on a Header
                        Rody Zakovich

                        Excellent point Simon.


                        I also want to add in the importance of the Data itself. Tableau lets you do a lot of things, but it is bound to the structure of your data. But, once we understand Tableau, we can make our lives a lot easier by doing some data-prep. I have found that most times, it is very easy to be "creative" when you are working with a Long Transactional Table, than it is a Wide Lookup Table. That said, a lot of our "creativity", has come from trying to build viz out of Wide Lookup Tables......



                        1 of 1 people found this helpful
                        • 24. Re: Educational Brain Teaser: Bold Single Label on a Header
                          Philip Tonge

                          Hi Simon.  Thanks for such an in-depth solution (and thanks to all those that posted content to contribute to this).


                          As a relative novice on Tableau, it's been great to read the different ways that people have tackled this problem and I've picked up lots of tips.


                          I particularly like the 'fake axis' solution as this reduces the occurrence of unwanted axis labels and unbalanced sizing of the different elements in the view.


                          As you mentioned in your solution, my OP does include the occurrence of a few PIs that have negative figures (I'm applying a filter to a list of PIs to change the content of the chart).  However, there are a relatively small number of these and since I'm also labelling each bar with the value, I can live with the fact that negative values aren't labelled on the axis in these instances.


                          I've not used the forums prior to this week, but have found everyone's input very useful, so thanks again to all who have posted.

                          1 of 1 people found this helpful
                          • 25. Re: Educational Brain Teaser: Bold Single Label on a Header
                            Simon Runc

                            Great stuff Philip, and thanks for updating us on the final solution (I always like to know how a story ends!).


                            Yes, although a specific example was used here, its the general principles of Tableau which are really being demonstrated (Blue/Green Pill, Mark Types...etc), and the thought process...which all the solutions here demonstrate so well and can be generalised/re-purposed to solve a whole host of challenges.


                            ...should have also mentioned in my blurb about 'how cleverly thought out Tableau is, and fun to use'...as you've found out....the 1st= best thing about Tableau is the Community!!

                            1 2 Previous Next