Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Experts,
Can you please help me on below:
I have each product with multiple prices with start and end date changing. I need the Current Price and Launch Price at a given point. Let's say, for product AC- Launch Price is 18.52 on 2019-03-01 but the current price has changed to 12.52 from 2021-01-01. I need to get the launch price(18.52) beside the current Price (12.52)
product | price | launch_date | start date | end date | current_price | launch_price |
AB | 3788 | 2019-04-02 | 2019-10-28 | 3788 | 4450 | |
AB | 4450 | 2019-04-02 | 2019-04-02 | 2019-10-27 | - | 4450 |
AC | 12.52 | 2019-03-01 | 2021-01-01 | 12.52 | 18.52 | |
AC | 13 | 2019-03-01 | 2019-08-03 | 2020-12-31 | 13 | |
AC | 18.52 | 2019-03-01 | 2019-03-01 | 2019-08-02 | 18.52 | |
AD | 100 | 2019-11-01 | 2021-01-01 | 100 | 90 | |
AD | 110 | 2019-11-01 | 2020-06-04 | 2020-12-31 | 110 | |
AD | 80 | 2019-11-01 | 2020-03-02 | 2020-06-03 | 80 | |
AD | 90 | 2019-11-01 | 2019-11-01 | 2020-03-01 | 90 |
The usual technique is to generate a row for every date in the start/end interval. Then the data model will have the correct values for every Product/Date combination and no special expression is required.
You can generate the values using either a While loop or Interval match. Here's an example with your data using While:
Join (Prices)
LOAD
*,
date([start date] + IterNo()-1) as CurrentDate
Resident Prices
WHILE [start date] + IterNo()-1 <= (if(len([end date]) > 0, [end date], Today(2)))
;
More examples here:
Qlikview Cookbook: Expand A Pricing Date Table
Qlikview Cookbook: Count Days In A Transaction Using Intervalmatch
-Rob
Thanks Rob for the response, however I'm not able to get current Price and launch price in same row for same product.
Below is the table structure I have .
Table A:
Start_date,
End_date,
Local_Price,
currency,
key
Table B:
Launch_date,
product,country,area,region,province,size,unit
name,
key
Expected data in table should be as below:
Product Current_Price Launch_Price
AB 3788 4450
AC 12.52 18.52
AD 100 90
I assume Current_Price comes from Local_Price? Are you saying you can't link values from TableA and TableB together? If so, perhaps the key values do not match.
-Rob
@rwunderlich ,Yes current price and launch price come from local price.And I'm able lo link Table A and Table B.We already have end-date available.
We need to get current price and launch price only based on product.
-Jaideep