Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I have a requirement as Below:
We have Products that can have a future Delivery Date. I need to calculate the Gap between the 2 consecutive Delivery Dates for EA Product. I will need to create 3 new columns as Start Gap, End Gap and the difference of the 2.
So for the first delivery Date of the Product 'A', Start Gap will be Todays Date and End Gap will be the first Delivery Date,
For the second Delivery Date the Previous End Gap will be the Start Gap as shown in the example below. The bold columns is the expected output
Product | Delivery Date | Start Gap | End Gap | Gap Months |
A | 12/1/2022 | Today | 12/1/2022 | 60 |
A | 12/1/2023 | 12/1/2022 | 12/1/2023 | 365 |
How can I create the Columns (Start Gap, End Gap) in the script. Please keep in mind Delivery Dates have to be grouped by the Product.
Attached is the sample file with 2 Products.
This can be handled with a pretty standard Peek-function usage. Prepare your data, order by delivery date, and start peaking the previous row. You start by finding the starting row for each product, the peek will either return null or a different product, and set start gap to Today(). For each following row, compare product to ensure the product chain and peek previous row end gap into start gap field. End gap field you can just set to delivery date, it's always the same. Add a preceding load to compare start and end gap for your gap months field.
Can u psl provide a sample QVF using my sample Data
can u pls provide a sample QVF that demonstrates how far your own efforts took you and describe which of the three derived fields you had difficulties with?