Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
kdaniels-obrien
Partner - Creator
Partner - Creator

Set Analysis with 2 Conditions

Hi, 

I am trying to use a set expression to count the number of orders closed today. I have read through other community posts but was unable to find a solution that worked for me. I am having some syntax issues but I have very limited experience with set expressions so I'm not sure what I'm doing wrong.  Here is what I have now:

Count(DISTINCT {<[OrderStatus] = {"Closed"}, timestamp(LastActivity, 'MM/DD') = timestamp(vToday , 'MM/DD')>} Order)

I want to count the distinct orders where OrderStatus = Closed and LastActivity date = a variable vToday. I have to do some timestamp formatting to get LastActivity and vToday to have matching formats. The error says error in set modifier.  Is anyone able to tell me what is wrong with my expression/how to fix it? 

Note: I use a variable vToday because there are some business cases where vToday does not equal Today()
 

1 Solution

Accepted Solutions
MayilVahanan

HI @kdaniels-obrien 

You can change the format in the script itself

Date(LastActivity, 'MM/DD') as LastActivity

in front end:

Count(DISTINCT {<[OrderStatus] = {"Closed"}, LastActivity = {"$(=Date(vToday , 'MM/DD'))"}>} Order)

but, you didn't include year in ur lastactivity.  Is it ur requirement??

 

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.

View solution in original post

2 Replies
MayilVahanan

HI @kdaniels-obrien 

You can change the format in the script itself

Date(LastActivity, 'MM/DD') as LastActivity

in front end:

Count(DISTINCT {<[OrderStatus] = {"Closed"}, LastActivity = {"$(=Date(vToday , 'MM/DD'))"}>} Order)

but, you didn't include year in ur lastactivity.  Is it ur requirement??

 

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.
kdaniels-obrien
Partner - Creator
Partner - Creator
Author

I use the LastActivity field in other places in my app so I don't really want to change it in the load script.  Is that the only way this will work? 

I probably should include year, I think I just forgot.. 😁