# QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements
QlikView Fans! We’d love to hear from you.
Rules, plus terms and conditions, can be found here.
Contributor II

## Easiest way to create intervals of Months

I am creating a report where it shows me the number of disputes within the first 30 days, 60 days, 90 days ect...

To get this I am getting the days between the dispute filed date and the date we created the account.

I was going to do a long formula saying if days are between 0-30 then it's month 1, 31-60 it's month 2, ect...

-Is there a script that can do this easier and am I taking the long way to my results?

-Does anyone have an example of script they use for something similar?

1 Solution

Accepted Solutions
Contributor II

## Re: Easiest way to create intervals of Months

I actually ended up going with this and it seems to have worked fine:

6 Replies

## Re: Easiest way to create intervals of Months

It sounds like the CLASS() function may give you the desired result.

cheers,

Oleg Troyansky

Upgrade your Qlik skills at the Masters Summit for Qlik - coming soon to Milan, Italy and Austin, TX!

MVP

## Re: Easiest way to create intervals of Months

Maybe with the class function (it works in chart too)

x:

*,

Class(date2-date1, 30) as int;

date(makedate(2015)) as date1,

date(makedate(2015) + floor(rand()*365)) as date2

AutoGenerate 1

While IterNo() <= 730;

Contributor II

## Re: Easiest way to create intervals of Months

I'm actually looking for each record to contain who many months it took until it had a dispute (if it had one)

See below:

MVP

## Re: Easiest way to create intervals of Months

Hi,

one solution could be:

Div([Dispute Date]-[Create Date],30)+1

hope this helps

regards

Marco

Contributor II

## Re: Easiest way to create intervals of Months

I actually ended up going with this and it seems to have worked fine:

MVP