7 Replies Latest reply on May 12, 2016 1:18 AM by ahmed.hasnaoui

    side-by-side bar conditional colors

    ahmed.hasnaoui

      Hello community,

       

      I will ask straight forward with my problem:

       

      I want to visualize budget (Global, open, committed).

      Simple by a side-by-side bar.

      Please help me with the conditional coloring for this!

       

      I tried so much, I looked at many discussions here, but no luck...

        • 1. Re: side-by-side bar conditional colors
          Stephane Marx

          HI Ahmed,

          I used superstore data for the example.

          Start by building a similar view to this one:

          one of your measure in column and your dimension in rows (or vice versa).

          Then drag into the your measure axis (here profit) another measure.

          You see then different bars for each measure appearing in the bar chart.

          Hope it helps.
          Best,

          1 of 1 people found this helpful
          • 2. Re: side-by-side bar conditional colors
            Stephane Marx

            If you don't want to display the value for a specific dimension (in my previous example by segment). Drag instead measure names and measure values in the rows and columns.

            By placing measure names onto the filter shelf you can chose what measure to display.

            • 3. Re: side-by-side bar conditional colors
              ahmed.hasnaoui

              Hi Stephane,

               

              thank you for your detailed answer.

              I want the bars to be vertically and not horizontal, how can I achieve this?

               

              Edit:

              Never mind Ctrl. + W swappes rows and columns, what makes the bar go vertically.
              However I was not dropping the measure in the axis but in the column/row field instead...

               

              2nd edit:

               

              Ok now I have my bars like I want them, how can I color only one measure?

              E.g. I have 3 measures: my budget, what I have ordered (open) and what I have already spent.

              How can I apply a conditional color to my budget bar?

              Lets say ordered + spent < budget then budget bar is green, red otherwise?

              • 4. Re: side-by-side bar conditional colors
                Stephane Marx

                Good it helped and you found how to swap columns and rows.
                So for coloring only one measure you have to follow a different process.

                Drag measure names into row or column.

                Then drag one 2 measure in the row shelf (I used Profit and Sales). Right click the second one (it's going to turn into darker green like on the screenshot below). Select dual axis.

                Tableau automatically assign 2 different colors (as you see in the color legend on the left).

                Drag then the third measure you want to use on one of the measure axis. like that:

                then to make a chart that makes sense, synchronize the axis by right clicking on one of them and ticking "synchronize axis".

                You can finally change the color palette by double clicking one of the color square in the color legend and selecting the colors you want for the different measures.

                1 of 1 people found this helpful
                • 5. Re: side-by-side bar conditional colors
                  Stephane Marx

                  For the second question about "conditional coloring".

                  Tableau allows to create "calculated fields" to perform some calculations. to do so right click anywhere in the dimensions or measures left pane:

                  Then enter your calculation:

                  IF SUM([Profit])>SUM([Discount]) THEN "green" ELSE "red" END

                  Place the calculated field on the color card of the Profit bar (your equivalent one in your dashboard).

                  You can then edit the color like I explained above (in the previous answer).

                   

                  Kind regards,

                  2 of 2 people found this helpful
                  • 6. Re: side-by-side bar conditional colors
                    Stephane Marx

                    Hi Ahmed, could you mark my other answers as helpful if they answered your questions? Kind regards

                    • 7. Re: side-by-side bar conditional colors
                      ahmed.hasnaoui

                      I am late but thank you Stephane!