Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Test:
Mapping Load
Invoice ID
rate
from yyy.....
source1
Invoice ID
Country
.applMap('Test',Invoice ID) as rates
..
from xxx....
my look up data is something like below
Invoice ID | Country |Billed Date | rate
1000 |UK |2-Aug| 10
1000 |UK |3-Aug| 13
1000 |UK |2-Sep| 12
My Issue is applymap is taking only the First value i.e 10 in this case.. the output should be 35 actually
Try this for your mapping load:
Test:
Mapping
LOAD [Invoice ID]
Sum(rate) as SummedRate
from yyy.....
Group By [Invoice ID];
Try this for your mapping load:
Test:
Mapping
LOAD [Invoice ID]
Sum(rate) as SummedRate
from yyy.....
Group By [Invoice ID];
Applymap only matches first find.
If you need the sum of rates use
Test:
Mapping Load
Invoice ID,
SUM(rate) AS Rate
From yyy.....
GROUP BY Invoice ID;
Hi,
Look
you can left join the source1 table by invoice id
with the sum of rate group by invoice id of the lookup data
Apply map won't sum up the values. Instead you will have to aggregate those values using aggregation function sum()
Load
"Invoice ID",
sum(rate) as rate
from yyy
group by "Invoice ID";
right join
source1:
Load
"Invoice ID",
Country,
"Billed Date"
from xxx....
it will give you result as
Invoice ID | Country |Billed Date | rate
1000 |UK |2-Aug| 35
1000 |UK |3-Aug| 35
1000 |UK |2-Sep| 35
I hope it is helpful.