Qlik Community

QlikView Deployment

Discussion Board for collaboration related to QlikView Deployment.

Not applicable

Calculate daily quantity from date range

Hi. I'm new to the community so go easy on me [Smiley Happy]

I'm trying to calculate daily quantities based on a range of dates (start date and end date). I'll try and explain a little better through a simple example:

StartDate

EndDate

Qty

01/10/10

05/10/10

10

02/10/10

03/10/10

6



The 'Qty' should be spread across all the days in the range meaning 2 (10/2) is counted for 5 days for the first record and 3 is counted for 2 days from the second record. This boils down to the two records above producing the following output (to chart)

Date

Qty for that day

01/10/10

2

02/10/10

5

03/10/10

5

04/10/10

2

05/10/10

2



(I hope I've worked this out right!)

I'm resigned to the fact the answer will probably involve aggr functions of some kind but thinking about them too much just makes me aggry!

Thanks Guys

Maria

1 Solution

Accepted Solutions
Not applicable

Calculate daily quantity from date range

Hello!!Maria,

Check attached QVW .

Regards,

Dixit Patel

5 Replies
Not applicable

Calculate daily quantity from date range

Should have said that the dates are in dd/mm/yy format - Sorry!

MVP
MVP

Calculate daily quantity from date range

Hello Maria,

I don't understand very much the "2 counted for 5 days" part, but using intervalmatch will do. Check the code and comments in this post to see if that helps. Although the fields are differents, but I think it may help you.

Regards.

Not applicable

Calculate daily quantity from date range

The "2 counted for 5 days" just means spreading the Qty of 10 across the range of 5 days. 10 divided by 5 equals 2.

I've had a look at that example you linked and some others. They look applicable but they look like they go the wrong way around. By that I mean they look like they're looking for a range a given date is in where I'm looking to take a range and expand it into given days.

Or maybe I'm missing something?Tongue Tied

Not applicable

Calculate daily quantity from date range

Hello!!Maria,

Check attached QVW .

Regards,

Dixit Patel

Not applicable

Calculate daily quantity from date range

That's a really neat use of the Interval function I remember from my training course!

Thanks very much, I'll give it a try.

Maria Big Smile

Community Browser