6 Replies Latest reply on Nov 14, 2018 12:23 PM by Joe Oppelt

    How to change a column position?

    Alan Gutierrez

      Hello Everyone I hope having a good day guys.

       

       

       

      Issue Description:

       

       

       

      I'm developing an analysis of different kind of sites. this sites have different records on the data and I made a classification of them.

       

      Fixed Sites: Sites with 4 or more Diesel records on the data

      Eventual Sites with less than 4 Diesel records on the data

       

      Also, I created a column to calculate the percentage difference between them. I created that column by using two measures (It was the only way that I could to make that column showed up) and actually ti works right. The only problem is that I ned to change the position of it.

      The column is on the first position and I need no change it to the last position (this is just a dessing demand, is not a funtionallity problem).

      cOLUMNLAST.PNG

       

      Development.

       

      The measures that I've had to made to get that Percentage Difference Calculation are the next ones:

       

      Firstly I use the Lookup property:

       

      [%Diesel LOOKUP]

      LOOKUP(AVG([Cost]),LAST())/LOOKUP(AVG([Cost]),0)

      percentage.PNG

       

      Secondly I use he Window_MAX property:

       

      [Comparing % Diesel Consumption]

      WINDOW_MAX(IF FIRST()=0 THEN IFNULL([% Diesel Lookup],0) END)

       

      percentage2.PNG

       

      I hope that someone can give me a hand to move the position column, it would be awesome. Thanks for reading

      By the way I couldn't attach the package file due to it is off of boundaries.

        • 1. Re: How to change a column position?
          Michael Hesser

          Hi Alan;

          I'll give it a look-- I'm sure others will too . I think the root of your problem stems from the placement of PROM(Cost) on Text; within Tableau, this drops it into the leftmost column.

           

          It's always a best practice to upload the workbook as a TWBX (rather than a TWB): this encapsulates the viz data and generally makes it easier for viewers to look at without re-connecting the data source.

           

          If you've never used a TWBX before, choose "SAVE AS" and select TWBX.

          • 2. Re: How to change a column position?
            Michael Gillespie

            You can't, because it's a dimension.  Measures always come after dimensions in Tableau.

             

            The only way you could do it is if you could convert it to a measure.

            • 3. Re: How to change a column position?
              Joe Oppelt

              Green pills ( such as AVG(Cost) ) always go at the end.

               

              Even more, you have them broken out by another dimension ([Diesel Eventual/Fixed].)

               

              You can make two separate calcs -- one for "Eventual" and one for "Fixed".

               

              Each would look something like this:

               

              If [Diesel] = 'Mth. "Eventual..." ' then [Cost] END

               

              (Note:  I truncated things there.  You'll use the full and proper strings where needed!)

               

              Put those two calcs on the detail shelf.  Change them to DISCRETE so that they become blue pills.  Now you can place all the blue pills in the ROWS shelf in any order you want.   Take [Diesel...] off COLUMNS.  Take Avg(cost) off the sheet.

              • 4. Re: How to change a column position?
                Deepak Rai

                You can use a LOD to get that Easily. 

                 

                Create These Calcs:

                FIXED:

                {Fixed Tech Installed:SUM(IF {Fixed Whatever dimension: SUM(Diesel Records)}>=4 Then Prom Cost  END)}

                EVENTUAL:

                {Fixed Tech Installed:SUM(IF {Fixed Whatever dimension: SUM(Diesel Records)}<4 Then Prom Cost  END)}

                 

                Now Create a Third Calc for Difference as:

                 

                SUM(FIXED)-SUM(Eventual)

                Drag all three to Rows

                Thanks

                Deepak

                • 5. Re: How to change a column position?
                  Michael Gillespie

                  What Joe said.  More elegant solution!

                  • 6. Re: How to change a column position?
                    Joe Oppelt

                    See attached.


                    I created the calc for "EVENTUAL".  You can do the same for "FIXED".

                     

                    It works on my Sheet7.  I'm not sure what's going on in your actual Diesel sheet.  I made a copy of it and added my calc.  Not the same number.  But I think you really don't need the table calcs.  If you are getting 94% by 9.2 by 9.8, then your percent calc can just be the division of the two individual calcs.