Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
HI All,
I have an aggregated value based on ID and dim1, In the front end it works fine, but I want to get this in the script level like below code.
can I get same like in the first table using script level coding. ?
test:
LOAD * INLINE [
ID, dim1, dim2, dim3, value1, value2
1, a, tt, ooo, 10, 50
1, a, xx, ppp, 20, 30
2, b, yy, qqq, 5, 20
2, b, zz, rrr, 3, 10
2, c, pp, sss, 8, 40
3, d, qq, ttt, 9, 90
4, e, rr, uuu, 5, 100
5, f, ll, vvv, 12, 80
];
NoConcatenate
Table1:
LOAD ID, dim1, dim2, dim3,
sum(value1) as value1,
sum(value2) as value2
Resident test
Group by ID, dim1, dim2, dim3;
left join(Table1)
LOAD ID, dim1,
sum(value1) as value1aggr
Resident test
group by ID, dim1;
drop table test;
HI @renjithpl
Try like below
test:
LOAD * INLINE [
ID, dim1, dim2, dim3, value1, value2
1, a, tt, ooo, 10, 50
1, a, xx, ppp, 20, 30
2, b, yy, qqq, 5, 20
2, b, zz, rrr, 3, 10
2, c, pp, sss, 8, 40
3, d, qq, ttt, 9, 90
4, e, rr, uuu, 5, 100
5, f, ll, vvv, 12, 80
];
NoConcatenate
Table1:
LOAD ID, dim1, dim2, dim3,ID&'-'&dim1 as Key,
sum(value1) as value1,
sum(value2) as value2
Resident test
Group by ID, dim1, dim2, dim3;
Join
LOAD Key,
FirstValue(dim2) as dim2,
FirstValue(dim3) as dim3,
sum(value1) as value1aggr
Resident Table1
group by Key;
drop table test;
HI @renjithpl
Try like below
test:
LOAD * INLINE [
ID, dim1, dim2, dim3, value1, value2
1, a, tt, ooo, 10, 50
1, a, xx, ppp, 20, 30
2, b, yy, qqq, 5, 20
2, b, zz, rrr, 3, 10
2, c, pp, sss, 8, 40
3, d, qq, ttt, 9, 90
4, e, rr, uuu, 5, 100
5, f, ll, vvv, 12, 80
];
NoConcatenate
Table1:
LOAD ID, dim1, dim2, dim3,ID&'-'&dim1 as Key,
sum(value1) as value1,
sum(value2) as value2
Resident test
Group by ID, dim1, dim2, dim3;
Join
LOAD Key,
FirstValue(dim2) as dim2,
FirstValue(dim3) as dim3,
sum(value1) as value1aggr
Resident Table1
group by Key;
drop table test;