Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi Everyone,
I have the sample data below and i would like to get the Previous Value Column,
For each Quarter, get the value of the previous one, either in the script or in the chart
Thank's in Advance
Hi Zineb,
May following code is helpful,
Table:
LOAD * INLINE [
Quater, Dim1, Dim2, Dim3, Value
Q1, D1, DD1, D001, 10
Q1, D1, DD1, D002, 20
Q2, D1, DD1, D001, 33
Q2, D1, DD1, D002, 54
Q3, D1, DD1, D001, 90
Q3, D1, DD1, D002, 20
Q4, D1, DD1, D001, 129
Q4, D1, DD1, D002, 40
];
Load *,
if(IsNull(peek(Value,-2)),0,peek(Value,-2)) as Previous
Resident Table
;
In Front end just take table box,
just go to sort in properties and sort the table as follow
Thank you everyone for your reponses, but all the solutions provided are not working.
I have tried this solution, to get Previous Data in a separate table and join it to my original table using a new generated key and playing with the quarter number.
PREVIOUS_DATA:
Load
'Q'&num(SubField(Quarter,'Q',2)+1) &'-'&DIM1&'-'&DIM2&'-'&DIM3 as Key_quarter,
Sum(PRIMES) as PrevPRIMES
resident MyTable
Group by Quarter,DIM1,DIM2,DIM3;
It worked perfectly.
Thank's Again.
Hi zjalalacssi,
Try like this.
Hi,
Did you try my solution also?
aggr(Above(Sum( PRIMES ) ),DIM1,DIM2,DIM3)