Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi all,
i have a table like this:
YQ | #People |
---|---|
2012-Q1 | 3 |
2012-Q2 | 5 |
2012-Q3 | 3 |
2012-Q4 | 6 |
i want to have a table where "#People" is always the current value plus the previous one, so that it looks like this:
YQ | #People |
---|---|
2012-Q1 | 3 |
2012-Q2 | 8 |
2012-Q3 | 11 |
2012-Q4 | 17 |
I tried to do it with:
#People + previous(#People) as #People
but this did not work.
What am i doing wrong ?
Thanks a lot!
K
you have to just create a new field. modify your load statement like :
Load *,
#People + previous(#PeopleNew) as #PeopleNew
Resident .....;
Thanks.
need to do this in the LOAD script...
Hi kalinkula,
This script should work
[Data]:
LOAD * INLINE [
YQ, #People
2012-Q1, 3
2012-Q2, 5
2012-Q3, 3
2012-Q4, 6];
[Data2]:
LOAD
YQ AS [YQ2],
[#People] AS [#People2],
RangeSum([#People], Peek('#People3')) AS [#People3]
Resident [Data];
Regards,
Sokkorn
you have to just create a new field. modify your load statement like :
Load *,
#People + previous(#PeopleNew) as #PeopleNew
Resident .....;
Thanks.
Thanks a lot!
This works - however: What do i doo if i have two quarters where i have Null() values, like for example, replace Q2 and Q3 with null values: How can i put '3' in those two records ?
regards,
K
Hi,
That should work like you mention. Anyhow, if it not work, you can try
NumSum(RangeSum([#People], Peek('#People3'))) AS [#People3]
Regards,
Sokkorn