4 Replies Latest reply on Oct 4, 2018 9:05 AM by Leigh Fonseca

    Calculate Aspect Ratio and display it at a string (16:9, 4:3)

    Leigh Fonseca

      I have found several posts for calculating a ratio and displaying it as a string, but all seem to display the ratio over 1 (e.g., 2:1, 4:1).  While I could group these values, there are a large number of possible inputs and it's ever changing.


      The dimensions are: Vertical Resolution and Horizontal Resolution.  The Aspect Ratio is determined by Vertical Resolution / Horizontal Resolution.  In Tableau, this will output a decimal (Aspect Ratio Calculated).  In Excel, you can calculate the ratio and set the number format to ##/## and it will display 16/9.  I can't seem to find any way to get Tableau to do this.


      In this case, it doesn't matter whether the separator is a colon (:) or a forward slash ( / ).  What is required is that the smallest whole number is the provided (e.g., the 9 in 16/9).



      Horizontal ResolutionVertical ResolutionAspect RatioAspect Ratio Calculated


      In the attached workbook, the field Aspect Ratio was calculated and formatted in Excel.  The field Aspect Ratio Calc performs the same calculation.  It will not correctly display the values when using the ##/## Excel formatting.


      Any suggestions are graciously welcomed.