2 Replies Latest reply: Nov 26, 2011 4:16 AM by Tresesco B RSS

    firstsorted value for two dimension

      Hi everybody,

       

      I have a problem with the firstsorted value function; I know that this function returns null value if there are two different values responding to the ranking criteria so I am trying to use two ranking criteria; My exoression is:

       

      firstsorted value ( Data_value,

      // first criteria

           ( aggr ( min ( criteria ) , dim1, dim2 , dim3 ),

      //second criteria

           - ( aggr ( sum ( volumes ) , dim1, dim2, dim3 ...))

       

      Qlikview does not show me any error but it doesn't work; could you please give me some help???

       

      Thank you very much in advance!

       

       

       

        • firstsorted value for two dimension
          Jean-Jacques Jesua

          Hi

           

          I think it's not possible with firstSortedValue because this function returns a single value for just one row.

          Maybe in the script ?

          Could you post a sample of your data.

          JJ

          • Re: firstsorted value for two dimension
            Tresesco B

            Hi,

             

            here is what i read -

            "

            firstsortedvalue( [ distinct ] expression [, sort-weight [, n ]] )

            returns the first value of expression sorted by corresponding sort-weight when expression is iterated over a number of records as defined by a group by clause. Sort-weight should return a numeric value where the lowest value will render the corresponding value of expression to be sorted first. By preceding the sort-value expression with a minus sign, the function will return the last value instead. If more than one value of expression share the same lowest sort-order, the function will return NULL. By stating an n larger than 1, you will get the nth value in order. If the word distinct occurs before the expression, all duplicates will be disregarded.

            " from HELP.

             

            so probably your second criteria is being treated as [, n] here, that is it is supposed to return the nth value in order (preceding with '-' sign leaving it with nothing as output- while its a numeric value causing it with NO ERROR).

             

            its purely what i guess.

             

            Regards,  tresesco