6 Replies Latest reply: Feb 28, 2016 5:35 PM by Marco Wedel

# 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?

• ###### 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!

• ###### 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;

• ###### 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:

• ###### 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

• ###### Re: Easiest way to create intervals of Months

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

• ###### Re: Easiest way to create intervals of Months

glad you found a solution.