3 Replies Latest reply on Aug 27, 2014 8:16 AM by Matt Lutton

    How to calculate ratios

    Robert Larity

      Hi - My apologies if this is an obvious newbie question - I've searched on the forums for an answer without much luck.

       

      I'm trying to show each of the values in my workbook (i.e. each type of "debt outstanding") as a % of the "Nominal GDP" value for the corresponding date. Please see the attached file.

       

      However, it's not obvious to me how I calculate a ratio when the numerator (multiple "debt outstanding" fields) and denominator ("Nominal GDP") are both under the same "Description" dimension.

       

      I'm really grateful for any help you can provide!

        • 1. Re: How to calculate ratios
          Matt Lutton

          This does make it difficult (your data structure).  I'd recommend reshaping your data, such that you have individual measures for each.

           

          How to Shape Your Data | Tableau Public

           

          Hope this helps.  Reshaping can be accomplished in the data source, via Custom SQL in Tableau, or through various ETL/reshaping tools.

          • 2. Re: How to calculate ratios
            Robert Larity

            Thanks Matthew. My data is actually shaped like the "Normalized Data" example shown on the link you provided (i.e. the example showing the "right" way to do it).  

             

            If we were to take that example (i.e. the one provided at the link, with net income for different companies), I'm basically trying to calculate a ratio of (Citi Group's Net income) divided by (General Electric's Net Income).

             

            It seems like I need to change my data structure, so that "Nominal GDP" is a column header/label, is that correct?

             

            Many thanks-

            • 3. Re: How to calculate ratios
              Matt Lutton

              Yes, that would make this a bit easier.  Those articles are a bit confusing, I agree with that -- Unless I'm mistaken, I don't believe your data is normalized in the way that Tableau would like.  What I think would make this much simpler is if Nominal GDP was its own column in the data source, as well as "Consumer Credit", "Debt Outstanding", etc. with Dimension values for things like "Sector", "Credit Type", etc.

               

              I'm not an expert on this--perhaps Aaron Clancy can provide some more specific guidance here.