Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Leo
Partner - Contributor II
Partner - Contributor II

Set Analysis with grater than (Not Working) Vs. IF statement (Working correctly)

Hello Community,


I'm performing a count of incident cases depending on the comparison of two dates. The MC_RD_MonthYear (Resolution Date) needs to be greater than CanD_MonthYear, the Date for which we are analyzing the data: 

  • Count(distinct IF(MC_RD_MonthYear>CanD_MonthYear,[%SRID]))
    • This formula works and bring the right results, I double check manually against the raw data.

The problem is when I try to pass this from the if to the Set Analysis:

  • Count({<MC_RD_MonthYear={">=CanD_MonthYear"}>} DISTINCT[%SRID])
  • Count ({<MC_RD_MonthYear={">=$(=[CanD_MonthYear])"}>} DISTINCT [%SRID])

When implemented any of this two last  expressions are returning me zero values. 

Can you please help me to see my error here?

 

3 Replies
Gysbert_Wassenaar

Try: Count({<[%SRID]={"=MC_RD_MonthYear>CanD_MonthYear"}>}distinct [%SRID]))

talk is cheap, supply exceeds demand
mikaelsc
Specialist
Specialist

set analysis expressions are evaluated once (per chart) 

what you expect is that it would be evaluated on every row of data

if you want to use set analysis (my guess for performance?), i'd suggest you

either create an extra field in your model (interval between 2 dates) 

or that you use a bit more complex set analysis: 

count ({%SRID={"=sum(MC_RD_MonthYear-CanD_MonthYear)>0"}}distinct %SRID)

 

(you don't make a selection on MC_RD_MonthYear, but on %SRID where the interval is positive

Leo
Partner - Contributor II
Partner - Contributor II
Author

Guys, Thanks a lot for you answers.
I need to go back to this and check, Sorry for the long turnaround time.