Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements
QlikView Fans! We’d love to hear from you.
Share your QlikView feedback with the product team… Click here to participate in our 5-minute survey.
Rules, plus terms and conditions, can be found here.
MalcolmCICWF
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
MalcolmCICWF
Contributor II

Re: Easiest way to create intervals of Months

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

Capture.JPG

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
MVP

Re: Easiest way to create intervals of Months

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

x:

load

  *,

  Class(date2-date1, 30) as int;

load

  date(makedate(2015)) as date1,

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

AutoGenerate 1

While IterNo() <= 730;

1.png

MalcolmCICWF
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:

Capture.JPG

Re: Easiest way to create intervals of Months

Hi,

one solution could be:

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

QlikCommunity_Thread_207104_Pic1.JPG

QlikCommunity_Thread_207104_Pic2.JPG

hope this helps

regards

Marco

MalcolmCICWF
Contributor II

Re: Easiest way to create intervals of Months

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

Capture.JPG

Re: Easiest way to create intervals of Months

glad you found a solution.

please close your thread and feel free to select helpful answers.

thanks

regards

Marco

Community Browser