Skip to main content
Announcements
Introducing a new Enhanced File Management feature in Qlik Cloud! GET THE DETAILS!
cancel
Showing results for 
Search instead for 
Did you mean: 
Shubhangi_01
Contributor III
Contributor III

Converting set analysis expression to if statement (edit script window)

Hello Everyone,

I am facing one issue, where my chart keeps refreshing continuously. When i checked i got to know that because I have used complex date expression in my set analysis it is getting refreshed continuously.

I have used the following expression to calculate my data in chart:

=COUNT({<[ProjectDecision]-={'Hold','Kill'},[Stage]-={'Launch'},
[Status]-={'Closed'},[ModelName]-={'YHE','OPG'},[LaunchDate] ={"<=$(=date#(Now(), 'yyyy-MM-dd'))"}>}
if(isnull([LaunchDate]),0,1))
/COUNT(DISTINCT ProjectID)

Can you please help me in converting this expression into Script expression.

I tried the below expression, but it is giving 0 :

Script in Edit Script :

if([ProjectDecision]='Kill',-1,
if([ProjectDecision]='Hold',-1,
if(Stage='Launch/Tracking',-1,
if(alt(if([ModelName]<>'YHE','',0),if([ModelName]<>'OPG','',0),1)=1,-1,
if([Status]='Closed',-1,
if(alt(date([LaunchDate]),'')='',-1,if(num(date([LaunchDate]))-num(date(Today()))<0,1,0
))))))) as ABC

Script in Chart (set analysis) :

=if(Count(if(ProjectID>0,if(ABC>=0,ProjectID)))=0,'',count(if(ProjectID>0,if(ABC>=0,ABC)))/Count(if(ABC>=0,ProjectID)))

Please let me know if you require any more information.

Please help.

Thanks in advance.

 

Regards,

Shubhangi

11 Replies
Brett_Bleess
Former Employee
Former Employee

Were you able to see if Marcus' last comments helped or not?  Please be sure to circle back and close out the thread if you got things sorted or let us know what you still need if you are still working on things.

Regards,
Brett

To help users find verified answers, please do not forget to use the "Accept as Solution" button on any post(s) that helped you resolve your problem or question.
I now work a compressed schedule, Tuesday, Wednesday and Thursday, so those will be the days I will reply to any follow-up posts.
Shubhangi_01
Contributor III
Contributor III
Author

Hi,

The solution which Marcus gave dint helped me.

But I did some research and solved it in a different way.

Thank you so much for your help and support.

 

Thanks,

Shubhangi