Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello,
due to Performance reasons I am trying to move some expressions into the load script. Somehow I always encounter issues with the if Statement. In my qvw file I use the following Set Analysis Expresssion which works perfectly fine:
round(aggr(sum( {$<ProductionKey={'Prod'}>}ProductionQty),ProductionSegmentID),0.01)
now I am trying to do the same in the load script with an if Statement:
Load
ProductionSegmentID,
if(ProductionKey = 'Prod',round(sum(ProductionQty),0.01)) as ProductionSegmentQuantity
resident Data Group by ProductionSegmentID;
Any ideas what I´m doing wrong would be highly appreciated.
Thanks
Stefan
Try this
LOAD ProductionSegmentID,
Round(Sum(If(ProductionKey = 'Prod', ProductionQty)),0.01) as ProductionSegmentQuantity
Resident Data
Group by ProductionSegmentID;
Try this
LOAD ProductionSegmentID,
Round(Sum(If(ProductionKey = 'Prod', ProductionQty)),0.01) as ProductionSegmentQuantity
Resident Data
Group by ProductionSegmentID;
A different approach might be:
Load
ProductionSegmentID,
round(sum(ProductionQty),0.01) as ProductionSegmentQuantity
resident Data where ProductionKey = 'Prod' Group by ProductionSegmentID;
- Marcus
Hello Sunny,
thanks a lot for the Help. SOmetimes you just don´t see the tree even though you are in the forest
Regards
Stefan
Hello Marcus,
thanks for the Input. The Where Statement won´t work in this case, because some rows which I also Need in the table are not flagged as ProductionKey = Prod.
Regards
Stefan