Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Connect 2026! Turn data into bold moves, April 13 -15: Learn More!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Date range allocation

Hi everyone

I have a some data as date range (e.g. "2-Apr-09 ~ 6-May-09), I need to allocate the days (i.e. 32days) and distribute to the month accordingly. (e.g. Apr is 29days and May is 5days)

I have an no ideas how to treat it using syntax / script?

Can anyone help me!

Thanks in advance.

5 Replies
Not applicable
Author

Hi,

This calculating should be in the script.

For calculating the number of days between the two dates you can use:

INTERVAL ( DATE ( [6-may-09] , 'D-MMM-YY' ) - DATE ( [2-apr-09] , 'D-MMM-YY' ) , 'D' ) AS DiffDays (formatting your date fields with the DATE function might be necessary to make a correct comparison)

For your second question you could do something like this:

INTERVAL ( MONTHEND([2-apr-09]) - [2-apr-09] ) AS DaysToMonth1,

INTERVAL ( MONTHSTART([6-may-09] ) - [2-apr-09] ) AS DaysToMonth2,

You may need to apply some dateformatting to your datefields, if they differ from each other..

Hope this helps!

Regards, Sander

sathishkumar_go
Partner - Specialist
Partner - Specialist

Hi

Use Interval function in Scripting(Load).

Use qlikview help in Interval then u get exactly??????

Not applicable
Author

Hi

Can you please further elaborate as I would like to show in table format as per attached.

Is it possible to do it like this?

Thanks in advance.

rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

For a specific example that matches your question, see the QV Cookbook sample "Count days in a transaction using IntervalMatch". You can download the QV Cookbook from:

http://robwunderlich.com/Download.html

-Rob

sathishkumar_go
Partner - Specialist
Partner - Specialist

Hi Plz find that attachements.

I think it ll solve ur problem. Anything need tell me!!