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

Announcements
Qlik Connect 2026! Turn data into bold moves, April 13 -15: Learn More!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Set Anlysis Causing Error

Hi guys,

I am having trouble with a particular expresion and was wondering if anyone had any ideas... I would like to count the number of systems in which, in their last test, they have passed, but the pass occurred over 18 months ago. I tried using the expression:


if
(

(
(only({$<DRTested = 'Pass'>}max(ContingencyDate)) < today() - 180 )


I tried using 'only' as it was causing an error putting set analysis into an if statement. Typically I would just like to do a count with set analysis like below:

count({$<ContingencyDate = { '<$(vComplianceRedDate)'}, DRTested = {"Pass"} >}SystemLocation)
where
vComplianceRedDate =date(addmonths(Today(),-18),'MMM-YY')


The problem definitely lies in the Date part as it filters to a pass before this. Has anyone got any ideas?

Regards,

3 Replies
brenner_martina
Partner - Specialist II
Partner - Specialist II

Hi, bcolgan85

Try that expression, in Set Analysis you must use this brackets { ...} again and "..." :

(only({$<DRTested = {"Pass"}>} max(ContingencyDate)) < today() - 180 )

Greeting from Martina from Germany



brenner_martina
Partner - Specialist II
Partner - Specialist II

Pardon ... and you can use the Num-Function, to change Date into number!

Not applicable
Author

Thanks,

My requirements have changed slightly - I would like to bring back the value for DRTested which has the maximum Contingency Date

ContingencyDateDRTested
04/05/2010Pass
06/03/2009Fail
01/02/2009Scheduled
05/08/2008Pass


So I would like to do a RAG (Red, Amber, Green) Statusso that if the most recent Value of the result is a pass and the pass happened within the last 18 months give it a Green RAG Status, if it is a Fail - red, etc. I tried creating a calculated dimension by merging both the fields together but I'm sure there is a better option? Has anyone any ideas?

Thanks,