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: 
soniasweety
Master
Master

Exclude Nulls

Hi all,

I have a column  Status

in that values are like below

Status

success

"success with no issue "

Failed

Unsuccessfull

-

so here  my requirement is  :    Caluclate the  Failed %

logic :  if(Status='successful' or Status='success With No Issues' or close_code='successful_issues', 'Yes','No') as StatusFlag,

Front end :

count({<StatusFlag={'No'}>}Number)

/count(Number)  

its working but  in data I have null values  if I take  flag value "No"   except success null also taking into consideration so  I want to exclude that  how to do?

12 Replies
tamilarasu
Champion
Champion

Hello,

count({<Status={'*'}, StatusFlag={'No'}>}Number)

/count(Number)

If you want to exclude the null status in denominator as well then change it to count({<Status={'*'}>}Number)

sudhirpkuwar
Partner - Creator II
Partner - Creator II

Hi,

Check this

soniasweety
Master
Master
Author

instead of in front end expression

how to write in if condition only  [means instead of success how can I write exclude null and failed and unsuccessfull]

soniasweety
Master
Master
Author

sorry am using Qliksense

tamilarasu
Champion
Champion

In that case, can we leave status_flag for null values as Blank? Something like below

If(Isnull(Status),'', If(Match(Status,'successful','success With No Issues') or close_code='successful_issues', 'Yes','No')) as StatusFlag

soniasweety
Master
Master
Author

sorry tamil

close_code is nothing but status only   below is original expression

logic :  if(Status='successful' or Status='success With No Issues' or Status='successful_issues', 'Yes','No') as StatusFlag

sudhirpkuwar
Partner - Creator II
Partner - Creator II

Hi

At Back End:

D1:

LOAD * INLINE [

    Status

    Success

    Success with no issues

    Failed

    Unsuccessfull

    -

];

Load *,

if(Status='Success' or Status='Success with no issues', 'Yes','No') as StatusFlag

Resident D1;

Drop Table D1;

EXIT SCRIPT;

Front End:

=Num(Count({<StatusFlag={"No"}>}StatusFlag)

/

Count(StatusFlag)*100,'##.00') & '%'

soniasweety
Master
Master
Author

this is db excuting the query

select count(number) from Main_tbl

  where Status = 'Failed ' or Status = 'Unsuccessful' or status = 'Not succeed'

tamilarasu
Champion
Champion

Don't be sorry, Sony . You can change your expression something like below.

If(Not IsNull(Status), If(Match(Status,'successful','success With No Issues', 'successful_issues') , 'Yes','No')) as StatusFlag


The above if condition will leave null status value flag (StatusFlag) as null.