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

Set Analysis Count If?

I would like this equation translated into Set Analysis.  This should be fairly straight forward but all the examples show X field is equal to 'X, X.' I am unable to find the correct syntax for an if statement with a comparison.

If today’s < greater than the assigned to date count the number of tickets regardless ofany other selections.

=count(if(num(vToday)<num(ASSIGNEDDATE), (TICKETID)))

Let me know if you have any other questions.

Thanks.

1 Solution

Accepted Solutions
Anonymous
Not applicable
Author

No need for if.  Or youcan use if witout set.  You have to use the example from Karl, but with

ASSIGNEDDATE_NUM

count({$<ASSIGNEDDATE_NUM={">$(vToday"}> TICKETID)

View solution in original post

13 Replies
pover
Luminary Alumni
Luminary Alumni

Try

count({$<ASSIGNEDDATE={">$(vToday)"}> TICKETID)

Karl

Not applicable
Author

This did not work but I think you are on the right track.  Just a matter of getting the syntax correct.

pover
Luminary Alumni
Luminary Alumni

I don't know what vToday is, so try,

count({$<ASSIGNEDDATE={">$(=today())"}> TICKETID)

Not applicable
Author

vToday was just a variable made for today.  I tried today() still does not work.

Anonymous
Not applicable
Author

Unlike "if", set analysis is sensitive to the date format.  To work, both ASSIGNEDDATE and today() (or vToday) must be in the same format.

pover
Luminary Alumni
Luminary Alumni

Ok, it should work.  If you need more help, it will be easier if you can upload a small, sample qvw of your data.

Karl

Not applicable
Author

Yes I attempted this as well. 

I am attempting to show how many tickets were opened on todays date.  So assigned date for each ticket.  I converted =num(assigneddate) AS ASSIGNEDDATE_NUM.  vToday is also defined in my load script as a num value.  See both text boxes below to view values.  TICKETID is just as the name applies.

qvdate.PNG

Not applicable
Author

I have now taken assigneddate in my load script this:

floor(num(ASSIGNEDDATE)) AS ASSIGNEDDATE_NUM,

This now converts all assigned to dates to be equal to todays date.  Just playing the the syntax again in set analysis.   Will post if I get it working.

Anonymous
Not applicable
Author

You need to use ASSIGNEDDATE_NUM in your set instead of ASSIGNEDDATE