14 Replies Latest reply: Dec 16, 2015 6:20 PM by Mark Bickett RSS

    Qlik Sense - Referencing Dimension Subtotals Dynamically in Line Chart

    Mark Bickett

      I am working in Qlik Sense, I have a ratio that I want to calculate comparing a line item measure to the subtotal of a different measure for the dimension.

       

      Dimension A - Value 1

                          Measure 1     Measure 2     Desired Result

      Item 1               10               20                    10/100 = 10%

      Item 2               20               30                    20/100 = 20%

      Item 3               10               50                    10/100 = 10%

                              40              100                    40/100 = 40%


      Dimension A - Value 2

                          Measure 1     Measure 2     Desired Result

      Item 1               15               20                    15/100 = 15%

      Item 2               30               30                    30/100 = 30%

      Item 3                 5               50                      5/100 = 5%

                              50              100                    50/100 = 50%

       

      This is the only way I have found to have the divisor be the sum of Measure 2 across the Dimension Value

       

      SUM ( Measure 1 )  / SUM(TOTAL <Dimension A>  Measure 2 )

       

      Unfortunately, this requires me to declare an explicit value for Dimension A, is there a way to select the Dimension dynamically based on the Dimension the chart (Object) the expression is used in?  Otherwise I fear I will have to declare it for each Dimension I want to use it in.