Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us in Bucharest on Sept 18th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Syntax using 2 Ifs.

Dear Qlikview community,

As mentioned in my previous post, i'm new in qlikview and I need your help to achieve below calculation

Here is the formula using excel

=COUNTIFS(B13:B20,"A",C13:C20,"")

Count nationality if it's A and the final process is null

Here is the sample data

                                        

NationalityFinal Process
a
a
A
b
3

I appreciate your help

31 Replies
Not applicable
Author

Hi, Thank you for your kind help, still "error in expression"

Here is the Data:

Nationality                         Final Process

A                                                  KKK

B

A

B

A

A

C

Requirements:

Count Final Process if it is null and Nationality is = A

Though there are 4 "A's, the answer should be 3 because the 1st record which is nationality A but the  final process in not null, hence it will not be counted.

I hope I explain it clearly.

Regards,


Kushal_Chawda

for your above data my expression is working

=count( if(lower(Nationality)='a' and len(trim([Final Process]))<=0,Nationality,null()))

Capture.JPG

MayilVahanan

Hi

Try like this

LOAD *, If(Upper(Trim(Nationality)) = 'A' and Len(Trim([Final Process])) = 0, 1) as AFlag INLINE [

    Nationality,Final Process

    A,KKK

    B,

    A,

    B,

    A,

    A,

    C,  

];

Nationality =Sum(AFlag)
3
A3
Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.
Not applicable
Author

Thanks Kush,

Though the expression is ok the result is "0".  Is there something that I did wrongly?

Thanks Mayil, I will try your solution and let you know.

Kushal_Chawda

It will be difficult to say without looking at your sample. Would you be able to share it?

Not applicable
Author

Good morning Kush,

Below is the sample file as well as the result I would like to accomplish

BGIDBusiness GroupEmpNoEmpNameNationalityDivCC Org LevelA. CodePerson TypesFinal Process
85Corporate
  Core Business
  Group                                                                      
Emp 1American 30 7209 Trainee
85Corporate Core Business
  Group                                                                      
Emp 2American 30 7206 REGULAR
85Corporate Core Business
  Group                                                                      
Emp 3American 30 7226 REGULAR 31-DEC-05
85Corporate Core Business
  Group                                                                      
Emp 4Canadian 30 7226 REGULAR 31-MAR-05
52Corporate Core Business
  Group                                                                      
Emp 5Sudanese 52 9900 REGULAR
85Corporate Core Business
  Group                                                                      
Emp 6Sudanese 30 7220 REGULAR
85Corporate Core Business
  Group                                                                      
Emp 7British 30 7600 REGULAR
85Corporate Core Business
  Group                                                                      
Emp 8British 30 7065 REGULAR
85Corporate Core Business
  Group                                                                      
Emp 9Egyptian 30 7006 REGULAR
Total Number of
  Active Employee
American2Count Nationality field
  is equal to American and Final Process field is Null
British2Count Nationality field
  is equal to British and Final Process field is Null
American1Count Nationality field
  is equal to American,  Final Process
  field is Null and Person Type field is equal to "Trainee"
sasikanth
Master
Master

hi,

Try some thing like that

=count({<Nationality={'A'} >} IF( LEN( [Final Process])=0,Nationality))

jagan
Partner - Champion III
Partner - Champion III

Hi,

Try this expression

Count({<Nationality = {'a', 'A'}, [Final Process] -= {"*"}>} Nationality)


Note: The above expression will be shown as invalid expression in Qlikview but it works.


Regards,

Jagan.

Not applicable
Author

Thanks Jagan,

It did not work.

Below is the data sample

BGIDBusiness GroupEmpNameNationalityDivPerson TypesFinal Process
85CorpEmp 1American 30Trainee
85CorpEmp 2American 30REGULAR
85CorpEmp 3American 30REGULAR 31-DEC-05
85CorpEmp 4Canadian 30REGULAR 31-MAR-05
52CorpEmp 5Sudanese 52REGULAR
85CorpEmp 6Sudanese 30REGULAR
85CorpEmp 7British 30REGULAR
85CorpEmp 8British 30REGULAR
85CorpEmp 9Egyptian 30REGULAR

Requirements:

#1

Count Nationality field is equal to American and Final
  Process field is Null

Answer is 2

Requirements # 2

          

Count Nationality field is equal to
  American,  Final Process field is Null
  and Person Type field is equal to "Trainee"

Answer is 1

Regards,


Not applicable
Author

Good morning Kush

Resending the data sample:

Below is the data sample

BGIDBusiness GroupEmpNameNationalityDivPerson TypesFinal Process
85CorpEmp 1American 30Trainee
85CorpEmp 2American 30REGULAR
85CorpEmp 3American 30REGULAR 31-DEC-05
85CorpEmp 4Canadian 30REGULAR 31-MAR-05
52CorpEmp 5Sudanese 52REGULAR
85CorpEmp 6Sudanese 30REGULAR
85CorpEmp 7British 30REGULAR
85CorpEmp 8British 30REGULAR
85CorpEmp 9Egyptian 30REGULAR

Requirements:

#1

Count Nationality field is equal to American and Final
  Process field is Null

Answer is 2

Requirements # 2

          

Count Nationality field is equal to
  American,  Final Process field is Null
  and Person Type field is equal to "Trainee"

Answer is 1