Hi guys,
Just wanted to ask how to get the PREVIOUS or last two (2) transaction dates based on the parameter entered using query designer?
This is my raw data:
Transaction Date | Customer | Material | Amount |
---|---|---|---|
20160121 | A | X | 10 |
20160201 | A | X | 20 |
20160210 | A | X | 30 |
20160225 | A | X | 40 |
20160304 | A | X | 50 |
20160316 | A | X | 60 |
I wanted to have this query:
My parameter is transaction date..So if user entered 20160201 - 20160228, this will be my result..
Customer | Last Transaction Date | Previous Transaction Date | Amount (based on Last Transaction Date) |
---|---|---|---|
A | 20160225 | 20160210 | 40 |
So if user again entered 20160101 - 20160131, this will be my result..
Customer | Last Transaction Date | Previous Transaction Date | Amount (based on Last Transaction Date) |
---|---|---|---|
A | 20160121 | 10 |
Another example, if user entered 20160306 - 20160315, this will be my result..Assuming I did not suppress ZERO result..
Customer | Last Transaction Date | Previous Transaction Date | Amount (based on Last Transaction Date) |
---|---|---|---|
A | 0 |
How can I achieve this in query designer? I'm planning to do this in transformation level but just giving a try if this can be achieved in BEx level..
LAST TRANSACTION DATE can be obtained by using the MAX function in formula..How about the PREVIOUS TRANSACTION DATE?
Thank you..
Loed