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

Data Count between Dates

Hi All,

I have the below data

   

Ticket NoOpen Date (MM/DD/YYYY)Close Date(MM/DD/YYYY)
11/10/20173/10/2017
22/15/20175/20/2017
33/11/20176/22/2017

And I want the final Output of total number if tickets per month as

   

Jan Open TicketFeb Open TicketMar Open Ticket
12(1 of Feb and 1 backlog of Jan)2(1 For Mar and 1 for backlog Feb, Jan ticket got closed in March hence not considered)

I am looking for a generic solution to populate the count if the ticket falls under a date range.

Thank you in advance.

Message was edited by: Manpreet Singh

8 Replies
Anil_Babu_Samineni

One solution may be this?

                                                                      Script:

Sample1:

LOAD [Ticket No], [Open Date (MM/DD/YYYY)] as DateField, 'Open Date' as Flag

FROM [https://community.qlik.com/message/1310037]

(html, codepage is 1252, embedded labels, table is @1);

Concatenate

LOAD [Ticket No], [Close Date(MM/DD/YYYY)] as DateField, 'Close Date' as Flag

FROM [https://community.qlik.com/message/1310037]

(html, codepage is 1252, embedded labels, table is @1);

Final:

NoConcatenate

LOAD [Ticket No], DateField, Month(DateField) as MonthField, Flag Resident Sample1;

DROP Table Sample1;

                                                                      Front End

1) Create Straight table

          Dimension is MonthField

2) and expression is

Count({<Flag = {'Open Date'}>}[Ticket No])

3) Give Accumulate 2 steps back


HTH

Anil

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
antoniotiman
Master III
Master III

Hi,

try this

LOAD *,MonthName(OpenDate,IterNo()-1) as OpenMonth Inline [
TicketNo, OpenDate, CloseDate
1, 1/10/2017, 3/10/2017
2, 2/15/2017, 5/20/2017
3, 3/11/2017, 6/22/2017
]
While MonthName(OpenDate,IterNo()-1) < MonthName(CloseDate
);

Chart :

Dimension ; OpenMonth

Expression Count(DISTINCT TicketNo)

Regards,

Antonio

Not applicable
Author

Hello Antonio,

Is it possible to show the data in below format? Remove the year '2017' from the header.

JanFebMarch
122
Not applicable
Author

Hi Anil,

It is not able to recognize the DateField. Can you pls assist.

Not applicable
Author

Hi Anil ,

The solution is not adding previous month open tickets, for e.g. for month of Feb , Jan open tickets are not getting added. Pls ahelp.

antoniotiman
Master III
Master III

Hi,

in Dimension : Month(OpenMonth)

Regards,

Antonio

Not applicable
Author

Thanks Much.

One Challenge which I am facing is if the open date is year 2015 or 2016 and close date in 2017 in that scenario the record is not considered.

Can you pls assist

antoniotiman
Master III
Master III

Why not ?

It also works.