Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
1600eads
Contributor III
Contributor III

isnull on an aggregate expression does not work

Happy New Year! Want to say thanks to you all in this forum. Have been tremendous on helping me get up to speed. 

I have a particular issue with trying to use an if statement to display a simple 'PENDING' and/or 'COMPLETE' text. 

Here is an overview of the data:

1600eads_0-1704315524521.png

There is a process of when an ID is PENDING and COMPLETE. I was helped before with finding the difference in days that stems from the same DATE column (column B). I don't think you can use a mixture of ifs and aggr syntaxes within the script so I tried to run it on the front end charts but was running into issues. Ultimately, take example ID# 5,6,7,10 - they were once PENDING then COMPLETE. Once that was initiated, I was able to find the difference in days. What I would like my output to be is COMPLETE instead of PENDING and COMPLETE as seen on column C since these orders are now complete.

This is where I tried to use the if statement: 

if(STATUS='PENDING' AND not isnull(SALESPERSON) and isnull(Aggr(Interval(Only({<STATUS={'COMPLETE'}>} PROCESSED_TIMESTAMP)-Only({<STATUS={'PENDING'}>} UPDATED_DATE), 'D'), ID) ) ,'PENDING',
if(STATUS='COMPLETE','COMPLETE')) 

To summarize - if the status is pending and a salesperson has been tied to that order and if there are no days difference then we know that process is still in the works/pending. if the status has both rows of the status PENDING and COMPLETE and also has a value for the daysdiff then we know that order has been complete. 

Looking for further directions and guidance if anyone has any! Thanks again.

 

Labels (4)
1 Reply
1600eads
Contributor III
Contributor III
Author

I was able to figure out my issue. For simplicity sake I will be using the same expression, but how does one use an aggregate function to create a flag dimension on the script level?

I'd like to create a flag dimension for this expression:

if(STATUS='PENDING' AND not isnull(SALESPERSON) and isnull(Aggr(Interval(Only({<STATUS={'COMPLETE'}>} PROCESSED_TIMESTAMP)-Only({<STATUS={'PENDING'}>} UPDATED_DATE), 'D'), ID) ) ,'PENDING',
if(STATUS='COMPLETE','COMPLETE')) 

Thanks again.