Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Q&A with Qlik - Qlik Cloud Migration: Questions about migrating to Qlik Cloud? Catch the latest replay!
cancel
Showing results for 
Search instead for 
Did you mean: 
shruthibk
Creator
Creator

comparing strings with date

hi all,

i am trying to compare the string with previous and current month date

 

reciddatestatus
11/1/2016active
12/1/2016retired
21/1/2016active
22/1/2016active
31/1/2016active
32/1/2016removed

i am trying to find the count of recid if the previous month status is active and the current month status is retired or removed

i have tried using if condition

sum(if((date=vPM and status='active') and (date=vCM and match(status,'retired','removed'))

,1,0))

where vPM=date(addmonths(max(date),-1),'MM/DD/YYYY') and vCM=date(max(date),'MM/DD/YYYY')

but i am getting sum as 0 please help me to resolve this

regards,

shruthi

Labels (1)
8 Replies
swuehl
Champion III
Champion III

Maybe like

=Count(

{<recid = p({<date = {'$(vPM)'}, status = {'active'}>}) * p({<date = {'$(vCM)'}, status = {'retired','removed'}>}) >} DISTINCT recid)

sunny_talwar
MVP
MVP

Are you doing this in the script or the front end of the application?

swuehl
Champion III
Champion III

And maybe you need to format your variables using

vPM=date(addmonths(max(date),-1),'M/D/YYYY')

shruthibk
Creator
Creator
Author

hi i tried in script as well as front end side both side not working

shruthibk
Creator
Creator
Author

it is not date format issue

shruthibk
Creator
Creator
Author

i tried this expression this is also giving count 0

shruthibk
Creator
Creator
Author

Hi this is giving the desired count one more requirement how can i count the null values in expression for example

along with retired and removed if the value is null it should count that value as well

swuehl
Champion III
Champion III

NULL is not a value and can't be selected. But you can derive the records to include indirectly, e.g. using e() function. Have a look at

Excluding values in Set Analysis