6 Replies Latest reply on Sep 10, 2018 7:23 AM by Min Thein Aung

    Adding Column

    Min Thein Aung

      Hello,

      I'd like to know if I can put respective "Regional Mgr" name to "Subtotal" rows in each partition...

      pic3.JPG

      ... as below?

      pic4.JPG

      In excel, I can create in PowerPivot by adding custom subtotal & grand total rows. But, since I'm a beginner, it's challenging in Tableau.

       

      Many thanks in advance!

        • 1. Re: Adding Column
          James Kording

          Hi Min Thein Aung,

           

          I am not sure if it is doable exactly as you have it displayed; however, you can get the same desired effect by moving the Regional Mgr pill over to the left so it sits between Region and City Code.  This will still give you the subtotals for each regional mgr but it will also avoid some confusion that could arise in your example where you have the regional mgr name under the Rep column.  Please see the screenshot below.

           

           

          Hope this helps.

           

          Jim

          • 2. Re: Adding Column
            Min Thein Aung

            Hi Jim,

            Yes, it should be in the format in your example to avoid confusion but I'm just curious to know since it can be created in Excel Pivot with some tricks.

            Anyway, Many thanks for your guidance.

            • 3. Re: Adding Column
              Sankarmagesh Rajan

              hi Min

               

              Yes, you can do this with union.

              SELECT [sample_date$].[City Code] AS [City Code],

                [sample_date$].[Number of Records] AS [Number of Records],

                [sample_date$].[Region] AS [Region],

                [sample_date$].[Regional Mgr] AS [Regional Mgr],

                [sample_date$].[Rep] AS [Rep],

                [sample_date$].[Sales] AS [Sales],

              'Data' as Aliasname

              FROM [sample_date$]

              union

              SELECT [sample_date$].[City Code] AS [City Code],

                [sample_date$].[Number of Records] AS [Number of Records],

                [sample_date$].[Region] AS [Region],

                [sample_date$].[Regional Mgr] AS [Regional Mgr],

                [sample_date$].[Rep] AS [Rep],

                [sample_date$].[Sales] AS [Sales],

              'Total' as Aliasname

              FROM [sample_date$]

               

              Create calculation as follows

              [Citycodeandtotal]

              if [Aliasname]='Data' then str([City Code])

              else 'Total'

              END

               

              [Repanmgr ]

              if [Aliasname]='Data' then [Rep]

              else  [Regional Mgr]

              END

               

               

              Thanks

              sankar

              2 of 2 people found this helpful
              • 4. Re: Adding Column
                Min Thein Aung

                Hi Sankar,

                 

                That's what I was looking for.

                Could you please share your edited 'twbx' to your reply for my reference?

                Thank you very much!

                 

                Regards,

                 

                Min

                • 5. Re: Adding Column
                  Sankarmagesh Rajan

                  Hi

                   

                  Workbook attached in my previous reply

                  • 6. Re: Adding Column
                    Min Thein Aung

                    Hi Sankar,

                     

                    Thank you very much!

                     

                    Regards,

                     

                    Min