Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
I have two tables
Table_1:
Table_2:
the desired pivot table is
Dimension:
Expression:
if(ValueList('SO', 'IN', 'Rcv1', 'Rcv2') = 'SO', only(AMT1),if (ValueList('SO', 'IN', 'Rcv1', 'Rcv2') = 'IN', only(AMT2),if (ValueList('SO', 'IN', 'Rcv1', 'Rcv2') = 'Rcv1',FirstSortedValue( aggr( NODISTINCT SUM(Table2.AMT), Table1.Item, Table1.Relation, Table2.ID3), Table2.Num,1),
FirstSortedValue( aggr( NODISTINCT SUM(Table2.AMT), Table1.Item, Table1.Relation, Table2.ID3), Table2.Num,2),)))
the issue is the firstsortedvalue (). It returns nothing.
if I just use the aggr without the firstsortedvalue then I get values but I can not separate the Rcv1 from Rcv2.
what am I missing here?
FirstSortedValue( DISTINCT aggr( NODISTINCT SUM(Table2.AMT), Table1.Item, Table1.Relation, Table2.ID3), Table2.Num,2)
Adding DISTINCT did the trick.