3 Replies Latest reply on Sep 21, 2019 10:00 PM by Soumitra Godbole

    How to combine two values in the bar chart?

    chen zhu

      Hi,

      I am new two the Tableau. I have a question about combine values.

      As shown below, 1 and "one" are actually the same thing. How can I combine there two columns? Since these two columns are the average, I can't just add the value of "1" and "one", then divide by 2.

       

      Also, I want to move "None" to the leftmost, is there a way to do that?

       

      Thanks a lot!

        • 1. Re: How to combine two values in the bar chart?
          Soumitra Godbole

          Ni Hao Chen Zu and Huanying to Tableau ! Your problem can be solved in 2 ways

           

          1) Creating Groups

           

          A) If you click on No of AC and group the values "One" & "1" as one and rename the

          grouped value to "1 & One" for your reference or anything you like (1,One). Then use

          the field No of AC (group) instead.

           

          B) To move the None to the left, the easiest way is to rename or edit alias to "  None".

              This will move it to the left (actually 2nd to the left), but I also see a blank and don't

              know whether that is a "" or " " (1 space) or multiple spaces. You could also group the

              2 left values ("" & "None") as one value

           

          2) Creating a calculated field called No of AC (Modified)

           

               Here you write

           

               IF [No of AC] = "One" then  "1"

               ELSEIF [No of AC] = "None" then ""

               ELSE [No of AC]

               END

           

           

          Here i am assuming the blank field is "" so what the above field does is it indirectly groups

          both the None and "" into one field "".

           

          Let me know which one works best. Hope this answers your question and best wishes.

           

          Zai jiyan

           

          Soumitra

          • 2. Re: How to combine two values in the bar chart?
            chen zhu

            Hi,

            Thanks for your help!. The second ways seems doesn't work. The column shows Null

             

            • 3. Re: How to combine two values in the bar chart?
              Soumitra Godbole

              Bu Ke chi ! No worries, since you did not share any dummy data, I went ahead and created some

              and have attached screenshots along with the packaged Tableau workbooks (twbx files).

               

              Method 1 : Grouping

              Method 1 - Grouping.png

              You can also rename the group headers (shown in Red Box)

              1 & One can be renamed to just 1

              2 & Two  to  2

               

              and so on. Remember these No's are in Text format

              If you want to change it to a number use FLOAT()

               

              FLOAT( [No of AC(group)] )

               

               

              Method 2 : Calculated Field

               

              Method 2 - Calculated Field.png

               

              Create the following formula  (shown above in red box) and it should do something similar

              Formula 2.png

              Hopefully one or both of the above methods should solve your problem. I have also attached

              the 2 twbx files below. Do let me know if you have any question.

               

              In case this answers your question, then please mark as helpful, correct answer to close the

              thread. This way others with a similar problem will easily be able to access this solution.

              Best wishes and Zai Jiyan !


              Sincerely,

               

              Soumitra