Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi
I have scenario,
I have one record per location.I need to calucalate growth i.e. Sales-Prev_sales
But when i use Peek function in script it is not working properly it is showing different values.
Expected is Prev_sales is 0 and Growth is Sames as Slaes.
Please so the needful for Peek what extra steps i need to configure in this case.
Thanks
Thiru
First you have to control the Sort Order of the load when checking the last value using peek(). Then make sure you check to check if the last record is from same Region and Location. Try like:
Load ....
If( Region=Peek(Region) and Location=Peek(Location),Peek(Sales),0) as Prev_Sales
resident Directory1 Order by Region, Location, Date;
PFA
What is the output you are looking for?
First you have to control the Sort Order of the load when checking the last value using peek(). Then make sure you check to check if the last record is from same Region and Location. Try like:
Load ....
If( Region=Peek(Region) and Location=Peek(Location),Peek(Sales),0) as Prev_Sales
resident Directory1 Order by Region, Location, Date;
PFA
What are you trying to do for this Prev_Sales? Would you describe more
Hi Anil,
I am looking for
Location | Date | Sales | Prev_sales | Growth |
2522 | 0 | 762 | ||
Bangalore | 01-11-2017 | 562 | 0 | 562 |
Chennai | 01-11-2017 | 560 | 0 | 560 |
Delhi | 01-11-2017 | 89 | 0 | 89 |
Hyderabad | 01-11-2017 | 460 | 0 | 460 |
Pune | 01-11-2017 | 851 | 0 | 851 |
Thanks
Thiru
Then Look Tresesco Suggestion and let us know