9 Replies Latest reply on Apr 18, 2017 5:36 PM by Gregory Diana

    Value Change with Calculation

    Alex Marlow

      Hi Everyone,

       

      I have pulled out two values and need to swap them based upon first and second place winners within the same state & District. Currently I'm pulling these through a function to separate. My calculation to swap 2nd and 1st place values is not working. This issue seems to be due to using a calculation value in another calculation.

       

      Here is what I am wanting to swap:

       

       

      Here is the link to my workbook: Tableau Public

       

      Thanks!

        • 1. Re: Value Change with Calculation
          Gregory Diana

          Rather than try and use the swap calculation simply move (drag with mouse in Rows) the 1st Or 2nd Place measure and place it between the District and Party Measures.

           

          Currently 1st Place Oppose and 2nd Place Oppose show the Oppose Expenditure votes for the 1st and 2nd placed candidates whose budgets have been opposed.

           

          I have attached the mod.

           

          Hope this helps.

           

          If you wish to order the candidates by the Oppose Expenditure votes then simply remove the 1st Or 2nd Order Measure altogether.

           

          I have made a sheet 7 and 8 which does this in the attachment

          • 2. Re: Value Change with Calculation
            Alex Marlow

            Hi Gregory,

             

            Can you elaborate a little more, please?

             

            Here is an image to visually show what I am looking for:

             

            Screen Shot 2017-04-17 at 10.19.43 AM.png

            So Bobby Bright's oppose amount ($1,518,489) would be moved to Martha Roby's column. Then Bobby Bright would have a total of $1,411,244 basically swapping the values of first and second place for the opposition amounts.

             

            Please let me know if you have any questions. I really appreciate your help!

             

            Alex

            • 3. Re: Value Change with Calculation
              Gregory Diana

              Hi Alex,

               

              I presume you want to do this (swap the opposition amounts) for all candidates and not just these two, is that correct ?

               

              Greg Diana

              1 of 1 people found this helpful
              • 4. Re: Value Change with Calculation
                Alex Marlow

                Hi Greg,

                 

                Yes you are correct. I was just showing one candidate as an example.

                 

                Thanks!

                 

                Alex

                • 5. Re: Value Change with Calculation
                  Alex Marlow

                  When I say correct, I mean that I do want this for all candidates.

                   

                  Thanks,

                   

                  Alex

                  • 6. Re: Value Change with Calculation
                    Gregory Diana

                    Hi Alex,

                     

                    I can do what you have above but the problem is the data is joined with other data so that simply swapping the amounts is not as easy as it appears as it is linked to many other tables.

                    It would require the original tables to changed which is probably not possible.

                     

                    Also not all districts have first and second, some only have first so it is not consistent.

                     

                    The best is to extract the data for this worksheet into excel and then manually do this and do a separate workbook for this chart.

                    Untitled picture.png

                     

                    I shall try this but you will have to resolve any teething issues.

                     

                    Cheers

                     

                     

                    Greg Diana

                    • 7. Re: Value Change with Calculation
                      Gregory Diana

                      Hi Alex,

                       

                      Ok I exported and changed in excel and it works fine.

                       

                      I then imported the excel file and that worked ok as well but it appears one has to export as much data as possible to enable the flexibility you require.

                       

                      I note on the bar graph that the support /oppose vote ATTRIBUTE was used to colour the bar but I did not export this variable so it is not linked to the main dataset.

                       

                      Anyway exporting and importing does work and it is just a case of how much data is required to be exported in which case all charts / worksheets etc may be done with the modified data.

                       

                      I have attached the excel file and Tableau worksheet. NY bits are in the last 2 worksheets.

                       

                      It is not a lot of work but swapping the data will take about an hour or so .

                       

                      Good luck. It would be easier to do this in ACCESS or wherever the data is hosted as one may simply make a revised table as I did manually.

                       

                      In some instances there is only one candidate sometimes first sometimes second so there is no clear rues to do it all at once.

                       

                      Cheers

                       

                       

                      Greg Diana

                      • 8. Re: Value Change with Calculation
                        Alex Marlow

                        Gregory,

                         

                        Thank you! You did not have to perform all those modifications...I was not at all expecting that. I'm thinking that I may have to perform the modification within Access. I want to make this process as automated as possible as this is one of many sets of this data.

                         

                        I was really hoping there would be an easy Tableau swap method that could be created to perform this. I know Tableau is more for only Data visualization though and not data clean up.

                         

                        Thank you again for all of your help!

                         

                        Alex

                        • 9. Re: Value Change with Calculation
                          Gregory Diana

                          Hi Alex,

                           

                          If the data was (strictly) queried with all first and second candidates of interest only then it would be simple to do the swap by creating a new table where one could extract all 2 and write to 1 in new table and vice-versa.

                          Thus all states and districts would have to have a first and second candidate and not the odd ones out to make the query easy.

                           

                          Cheers

                           

                           

                          Greg Diana