Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
microwin88x
Creator III
Creator III

Count Field for Previous Months

Hello,

I have the following table:

ID_TCKTSTATUSYEARMONTH_STATUSCREATE_DATECREATE_TIMEMONTH_CALENDAR
TCKT05In Progress2016Jul15/07/201614:29:33Jul
TCKT05In Progress2016AugJul
TCKT05In Progress2016SepJul
TCKT05Closed2016OctJul
TCKT02In Progress2016May02/05/201619:51:00May
TCKT02In Progress2016JunMay
TCKT02Completed2016JulMay
TCKT02Completed2016AugMay
TCKT02Closed2016SepMay
TCKT02Closed2016OctMay
TCKT03Planned2016May20/05/201602:45:53May
TCKT03Planned2016JunMay
TCKT03Closed2016JulMay
TCKT03Closed2016AugMay
TCKT03Closed2016SepMay
TCKT07In Progress2016Oct15/10/201612:35:48Oct

Each ID_TCKT has a CREATE_DATE/CREATE_TIME associated to a Master Calendar by a field MONTH_CALENDAR, so if I choose month = Jul I see TCKT05, if I choose month = May I see TCKT02 and TCKT03. Each ticket appear once, depending on selected month.

The issue is that I need to add the following logic:

If I choose any month, for example, MONTH_CALENDAR = Jun I need to COUNT how many tickets have STATUS <> Closed until the previous month from MONTH_STATUS field, in this case: MONTH_STATUS = May and this is what I should get, by using a Text Object:


- TCKT05: 0 (Because the ticket was Created in Jul)

- TCKT02: 1 (Because the ticket was In Progress in May)

- TCKT03: 1 (Because the ticket was Planned in May)

- TCKT07: 0 (Because the ticket was Created in Oct)

So the total COUNT would be = 2

Another example, if MONTH_CALENDAR = Oct we have to count tickets with STATUS <> Closed until MONTH_STATUS = Sep:

- TCKT05: 1 (Because the ticket is In Progress in Sep)

- TCKT02: 0 (Because the ticket was Closed in Sep)

- TCKT03: 0 (Because the ticket was Closed in Sep)

- TCKT07: 0 (Because the ticket was Created in Oct)

So the total COUNT would be = 1

I tried to use Set Analysis but I couldn't get what I need...

Do you know how could I do that?

Thank you!

3 Replies
vinieme12
Champion III
Champion III

Please don't double post

Count Tickets until Previous Month

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.
microwin88x
Creator III
Creator III
Author

Hello. Is there any way to use the previous month here?


Because with MIN(NUM_MONTHCal) I get the one I selected:


=count( {<NUM_MONTHStatus = {"<=$(=MIN(NUM_MONTHCal))"} , STATUS -={'Closed'} >}DISTINCT ID_TCKT)

vinieme12
Champion III
Champion III

change the Set Expression to just < instead of <=

=count( {<NUM_MONTHStatus = {"<$(=MIN(NUM_MONTHCal))"} , STATUS -={'Closed'} >}DISTINCT ID_TCKT)

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.