0 Replies Latest reply: May 27, 2013 8:35 AM by Davide Ducco RSS

    Sum combined with firstsortedvalue

    Davide Ducco

      Hi all,

      I have the need to use the sum aggregation filtered by a set analysis expression that contains a firstsortedvalue expression.

       

      For example, I have the following data:

       

      F1 F2 F3 F4
      A pippo 2 1
      A pippo 3 1
      A pluto 4 2
      A pap 6 3
      B cip 2 4
      B paperone 4 6
      B pippo 7 4
      B pluto 11 5
      C pippo 1 8
      C minni 3 6
      C pluto 4 7
      C
      5 2
      C ciop 5 5

       

      I have a table which contains the first value of F2 order by F4, like below:

      F_agg =if(F_agg='Other',null(), F1) FirstSortedValue({$<F2-={""},F_agg={'Best'}>}distinct F2,F4)
      Best A pippo
      B pippo
      C ciop

      Now my issue is to get in a new column the sum(F3) only for the value of F2 return by firstsortedvalue.

      I try with set analysis but without results.

      Any idea?

       

      Thanks in advance,

      Davide