2 Replies Latest reply on Oct 4, 2018 5:06 AM by suresh.gooty

    Origin-Destination and Destination-Origin as one field

    Elmurat Bavlankulov

      Hi All Tableau People,


      hope you are all doing great.


      I have one challenge in Tableau.


      I have two different dimensions Origin and Destination (three letter airport code). The data is in transaction level. Each transaction has 1 Origin and 1 Destination.

      I can create a calculated field "Route", which is just [Origin]+[Destination]. For example LHR-CDG. So I can see amount of bookings (which is COUNTD of booking ID) for that Route.


      My question is how can I include in LHR-CDG also route CDG-LHR?


      Let's say LHR-CDG has 1000 bookings, and CDG-LHR has 1200 bookings.


      So new calculated field should have numbers 2200 for LHR-CDG.



      Thanks in advance for your help.

        • 1. Re: Origin-Destination and Destination-Origin as one field
          Jim Dehner

          Good morning

          Have you considered a new calculation  for a string field for counting purposes?-              Min([origin],[destination] + max([origin],destination]

          it will create a concatenated field where it origin / destination pair are in alphabetical order




          If this posts assists in resolving the question, please mark it helpful or as the 'correct answer' if it resolves the question. This will help other users find the same answer/resolution.  Thank you.

          • 2. Re: Origin-Destination and Destination-Origin as one field

            simple question but required some workaround... without creating table alias and reverse the function or reverse the source and destination you can't achieve this.... some examples below with data








            before taking data into tableau you should write query to get your designed output in sql and then get the data that would be more easy to resolve this as it require joins and reverse of source and destination logic.... i should have solved but need some time time to get complete.... try with this information and see if you think from here to solve the issue....