Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I used first sorted value to make my calculation, My aim was to take max of total, concatenate reasons while mat is same and print tur which corresponds to max total.
However there may be equality of total for different inputs(rows). In such cases, I would like to create a priorization among turs. If there is equality in among totals "bi" should be first to print then, "ek"and then "ka".
So below case instead of - , "bi" should be printed.
p.s.In case are two distinct line where tur and the total are the same, it should print tur itself in instead of "-"
Raw:
load
tur,
mat,
total,
reason
From mysource;
Calculation:
LOAD
FirstSortedValue(tur,-total,1) as "tur1",
mat as mat1,
max(total) as total1,
concat(reason) as reason1
Resident Raw
Group by mat
In this case FirstSortedValue(DISTINCT tur,-total,1) as "tur1",
worked for me because the alphabetical order BI / EK / KA matches.
Unfortunately, it did not work at my local, it brought "ka" instead of "bi". From what understood from other community posts is that distinct was bringing random inputs.
@ayseayse Did you find a solution?
I tried several approaches but nothing worked...