Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I have in a table different prices for an article, for example:
for 10.11.2009 price is 50
for 11.11.2009 price is 40
for 15.11.2009 price is 47
One can notice that days 12.11, 13.11 and 14.11 are missing. This means in fact that the price for those days was the same as for 11.11. If the price doesn't change, we don't have a new row in the table.
Practically, I need a table (pivot, straight, doesn't matter) that should show, for a specific day chosen by the user, the price for that article for that day. Of course, a user can select a day without change (as in my example above).
I succeeded to find which is the maximum day for which the last price was filled in the table (see in my attached QVW). Can anyone give me an idea of how to realize this?
Thank you.
You could use intervalmatch to fill in the prices for all dates. That's probably what I'd do unless my data set was simply too large for that approach.
Thank you, John. Yes, my first option was also to fill the prices for all days, but the application was simply too heavy in terms of dimension on disk, so I started to search for an alternative. I didn't loose my hope yet to find a way to calculate this in a chart's expression.
I found a solution, maybe not the most elegant one, but it seems to be working. The expression that gives me the price for a specific day is:
right(concat(if(Date<=vDate,Price),'; ', Date), len(concat(if(Date<=vDate,Price), '; ', Date)) -index(concat(if(Date<=vDate,Price), '; ', Date),';','-1'))