try like this
LOAD MonthName(Date) as Month,
Num([Production % at End of Month]) as %Production
(html, codepage is 28591, embedded labels, table is @1);
NoConcatenate LOAD *,If(CustomerID=Peek(CustomerID) and ProductID=Peek(ProductID),
RangeSum(%Production,-Peek(%Production)),%Production) as Diff
Resident Temp Order By CustomerID,ProductID,Month;
Drop Table Temp;
Thanks a lot for your reply. It was a great help and ultimately worked well.
I had a problem, which I managed to solve somehow by now -
My Fact table was actually concatenated with other tables. and the noconcatenate clause created a problem.
What I did to solve this was to create another Load and using Resident to the the last table in the script.
Anyway Thanks a lot. Brilliant.
Thanks for your reply as well. felipedl
Try the following
Load * Inline
Date,CustomerID,ProductID,Production % at End of Month
RowNo() as Id,
MonthName(Date) as Month,
fabs(if(RowNo()=1 or ProductID<>Previous(ProductID),num([Production % at End of Month],'#0,0'),(1-[Production % at End of Month])-(1-previous([Production % at End of Month])))) as NewPercentage;
[Production % at End of Month]
order by CustomerID,ProductID,Date;
drop table x;