Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
MalcolmCICWF
Creator III
Creator III

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
Creator III
Creator III
Author

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

Capture.JPG

View solution in original post

6 Replies
Oleg_Troyansky
Partner Ambassador/MVP
Partner Ambassador/MVP

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!

maxgro
MVP
MVP

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
Creator III
Creator III
Author

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

MarcoWedel

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
Creator III
Creator III
Author

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

Capture.JPG

MarcoWedel

glad you found a solution.

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

thanks

regards

Marco