2 Replies Latest reply on Dec 29, 2018 1:58 PM by Jonathan Drummey

    Build bar graph with different data structure - Aggregate just some dimensions of same row

    Yanik LacroixTorrent

      Hello Tableau Community,

       

      I've been facing a problem for quite a long time and still not able to solve it. I have a data set that have a set structure to build some other visualizations and it's part of a bigger Dashboard, so I want to try not to change the data structure. I'm trying to come up with a bar graph that shows me a comparison of the prices against the competitors.

       

      The format of my Dataset looks something like that:

      And the final graph that I want to be able to achieve is:

      Any ideas on how I can combine the two Ryanair Prices on one bar (an average of them can work, because they are always the same price), with also showing both other prices, in other two bars?

       

      All I'm able to achieve for the moment is something like this:

       

       

      Thanks a lot for the help!

        • 1. Re: Build bar graph with different data structure - Aggregate just some dimensions of same row
          Patrick Van Der Hyde

          Helly Yanik,

           

          Is there any additional field to tie the Ryan Air flight data to the competitor?  Ideally the data would be in a single column of price, product, and description so that they could then be totaled by product in a viz. 

           

          Patrick

          • 2. Re: Build bar graph with different data structure - Aggregate just some dimensions of same row
            Jonathan Drummey

            Hi Yanik,

             

            It's not uncommon in Tableau to use multiple data sources to answer different questions, and with dashboards, filter actions, cross data source filters, etc. the user doesn't have to know that there are multiple data sources behind their workbook. So as a first recommendation I'd go with Patrick's suggestion.

             

            As a second recommendation it's possible to build a chart with all three prices:

             

            Screen Shot 2018-12-29 at 3.52.40 PM.png

             

            What I did was build out a measure for each airline. The RyanAir measure has the formula {FIXED [Airline], [Flight Number] : MIN([Price])} in order to prevent the replicated price values from affecting any averages, while the EasyJet measure has the formula IF [Competitor] = 'EasyJet' THEN [Competitor Price] END and the WizzAir is similar in structure.

             

            I've attached a v10.5 workbook using the data that you'd posted in a screenshot showing this.

             

            While this method works it's not ideal because it:

            • Requires a new calculated field for every competitor.
            • Does not allow for control over user filters (since we're using Measure Names/Values to build the view, all the Measure Names always show in the filter.
            • Does not support quick table calculations across the measures for example difference, % difference, etc. You can manually build calculations to do this but then that's again requiring a new calculation for each competitor. Whereas if the data was in the "tall" structure that Patrick suggested then quick table calculations would be available in a few clicks.

             

            Hope this helps!

             

            Jonathan