3 Replies Latest reply: May 4, 2016 6:35 AM by Matt Storey RSS

    Calculated dimension within aggr function

      Is it possible to use an expression as the dimension within an aggr() function.  The field that I am trying to aggr() on is an inputfield.  In order for the inputfield to behave like other fields in that it stores and represents every unique value of the field, I have to use the formula:

      =text(inputfield).  I'm wanting to do the following...aggr(sum(sales),text(inputfield)).  This does not seem to be working and I think it's because of the expression which is used as the dimension in the aggr() function.  How else can this be done?

        • Re: Calculated dimension within aggr function
          Miguel Angel Baeyens de Arce

          Hi,

           

          Inputfields will not work within the Aggr() function. They will not work as dimensions even if you don't use the Aggr(), note how the ID in the attached application is an inputfield and how the straight table does not aggregate by ID, but it does when you change the script to make to rows have the same ID. QlikView "knows" somehow that the value is not it's not the source value, and although it displays the new entered value, does not aggregate it, as you can see in the file.

           

          The idea on inputfields as far as I'm concerned is not about dimensions, rather than expressions, meaning that they are inteded to store numeric values that can change and may affect to some aggregations that in turn must use their own functions, like InputSum() or InputAvg().

           

          By the way, I'm using version 11, and I have not tested it in previous versions, but I guess they behave likewise.

           

          Hope that makes sense.

           

          Miguel

            • Re: Calculated dimension within aggr function

              The inputfield does work as a dimension in the table on the right if you change the dimension from 'ID' to =Text(ID).  In other words, inputfields treat every value in them as unique, even if they are identical in content.  But when you use the 'Text' function, it groups like values together in the input field so that it behaves like any other normal field.  Therefore, it can be used as a dimension with this slight workaround.  I'm wanting to know if there is some way to perform aggregation on this Text(inputfield) value either using aggr() or set analyis or some other method.

            • Re: Calculated dimension within aggr function
              Matt Storey

              This is a longshot but did you ever find a solution to this problem?

              I have exactly the same issue and am pretty stuck.

              I need to use the Aggr Function in order to retrieve the Top X.

              My data looks like the below

              The text field is the input so I would want to use the Aggr to perform a group by sum, i.e. a total for 'Misc-Other','Industrial - SE' etc etc

               

              2016-05-04 11_34_45-QlikView x64 - Resellers Copy - [C__Users_HankStoreo_Dropbox_LaSalle_Developmen.png