Note: This was originally posted by an inactive account. Content was preserved by moving under an admin account.
Originally posted by: dbrandstaedterHey guys,
I'm having trouble understanding the "lastInGroup" function:
I tried to transpone a dataset in a somewhat cumbersome way.
screenshot.png
I have an AggEx node "split by month" which outputs the following data:
zLABST_01 zLABST_02 zLABST_03 zLABST_04 zLABST_05 zLABST_06 zLABST_07 zLABST_08 zLABST_09 zLABST_10 zLABST_11 zLABST_12 MATNR LFGJA LFMON
74763.447 0 0 0 0 0 0 0 0 0 0 0 432 2012 1
0 73296.907 0 0 0 0 0 0 0 0 0 0 432 2012 2
0 0 31049.947 0 0 0 0 0 0 0 0 0 432 2012 3
0 0 0 67289.202 0 0 0 0 0 0 0 0 432 2012 4
0 0 0 0 48789.434 0 0 0 0 0 0 0 432 2012 5
0 0 0 0 0 51605.172 0 0 0 0 0 0 432 2012 6
0 0 0 0 0 0 39482.568 0 0 0 0 0 432 2012 7
0 0 0 0 0 0 0 30434.664 0 0 0 0 432 2012 8
0 0 0 0 0 0 0 0 39084.352 0 0 0 432 2012 9
0 0 0 0 0 0 0 0 0 10378.995 0 0 432 2012 10
0 0 0 0 0 0 0 0 0 0 34551.411 0 432 2012 11
0 0 0 0 0 0 0 0 0 0 0 33849.352 432 2012 12
Now, I use this data as an input for another Agg-Ex "agg months" using the following code:
m01 = groupSUM(zLABST_01)
m02 = groupSUM(zLABST_02)
m03 = groupSUM(zLABST_03)
m04 = groupSUM(zLABST_04)
m05 = groupSUM(zLABST_05)
m06 = groupSUM(zLABST_06)
m07 = groupSUM(zLABST_07)
m08 = groupSUM(zLABST_08)
m09 = groupSUM(zLABST_09)
m10 = groupSUM(zLABST_10)
m11 = groupSUM(zLABST_11)
m12 = groupSUM(zLABST_12)
emit m01 as "zLABST_01"
emit m02 as "zLABST_02"
emit m03 as "zLABST_03"
emit m04 as "zLABST_04"
emit m05 as "zLABST_05"
emit m06 as "zLABST_06"
emit m07 as "zLABST_07"
emit m08 as "zLABST_08"
emit m09 as "zLABST_09"
emit m10 as "zLABST_10"
emit m11 as "zLABST_11"
emit m12 as "zLABST_12"
emit referencedFields(1,{{^GroupBy^}})
where lastInGroup
Data is grouped by "MATNR, LFGJA". The output is the following:
zLABST_01 zLABST_02 zLABST_03 zLABST_04 zLABST_05 zLABST_06 zLABST_07 zLABST_08 zLABST_09 zLABST_10 zLABST_11 zLABST_12 MATNR LFGJA
0 0 0 0 0 0 0 0 0 0 0 33849.352 432 2012
When I was expecting the sum of each columns of the 12-row table.
I tried to sort the data but didn't succeed. On the contrary, it seemed to have a somewhat random effect summing up different columns every time I re-run the node.
Any ideas?
Thanks!