Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi, I am trying to filter a pie chart using an expression to count the Product IDs where [("Program" = "Math" or "Liberal Arts") and Graduation Date >= 10/1/2022] or [("Program" = "Math" or "Liberal Arts") and Graduation Date = null]
I have the first part of the equation:
=count({<
Program={'Math','Liberal Arts'}
, [Graduation Date]={">=$(=Date(Date#('10/1/2022','MM/DD/YYYY')))"}
>}distinct [Product ID])
I don't know how to add on the second half of the expression and the null part. Any help welcome!
Hi, perhaps like this.
=count({<Program={'Math','Liberal Arts'}, [Graduation Date]={">=$(=Date(Date#('10/1/2022','MM/DD/YYYY')))"}> + Program={'Math','Liberal Arts'}, [Graduation Date]={"=IsNull([Graduation Date])"}>}distinct [Product ID])
Hi
Here below an example with OR AND in set analysis
https://community.qlik.com/t5/New-to-Qlik-Sense/Qlik-sense-set-analysis-and-or/td-p/1337192
😞 It didn't work.
I simplified the expression to this below and this part might be where the error is:
=count({< [Graduation Date]={"=IsNull([Graduation Date])"}>}distinct [Product ID])
[Graduation Date]= {'=Len(Trim([Graduation Date]))=0'}
If you have a field that uniquely identifies records
ID = E({<[Graduation Date]= {"*"}>})
The best way would be to assign a value to null values in the script
If(IsNull([Graduation Date]) or Len(Trim([Graduation Date]))=0, 'NULL', [Graduation Date]) as [Graduation Date]
and then use it within the expression.
[Graduation Date]= {'NULL'}
Either of below should work
=count({< Program={'Maths','Liberal Arts'},[Graduation Date]={">=$(=Date(Date#('10/01/2022','MM/DD/YYYY')))"}>
+< Program={'Maths','Liberal Arts'}, [Graduation Date]={"=len([Graduation Date])<1"}>
} [Product Id] )
OR
=count({< Program={'Maths','Liberal Arts'}
,[Graduation Date]= p({<[Graduation Date]={">=$(=Date(Date#('10/01/2022','MM/DD/YYYY')))"}>} [Graduation Date])+p({<[Graduation Date]={"=len([Graduation Date])<1"}>} [Graduation Date])
>} [Product Id] )