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

How to Count matching values in 2 different fields

HI

Im fairly new to qlikview and im trying to do the following , in the below table there is 3 zeros in the picked column and 3 zeros in the BOH column, so there is 3 instances were picked  = 0 and BOH = 0.

how do i create an expression where i can get the value 3 returned ( this is the 3 instances were 0 = 0.)

pickedBOH

1

1
00
00
00
54

i believe in excel the countifs function can be used.

thanking you in advance

Lynn

8 Replies
Anil_Babu_Samineni

Are you expecting this?

Count({<picked = {'0'}, BOH={'0'}>} Measure)

OR

Count(If(picked=0 and BOH = 0,Measure))

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
Not applicable
Author

im trying to determine where ever picked = 0 and BOH = 0, how many instances of that is there.

sam_grounds
Contributor III
Contributor III

Hi Lynn,

This should do the trick. You just need to compare the two fields against each other to find matches...

=num(count(if(picked=BOH,[YourMainIdentifierField])),'#,##0')

If you're only matching the 0's, then this will suffice...

=num(count({$<picked={0},BOH={0}>}[YourMainIdentifierField])),'#,##0')


Sam

sathishbabu_s_g
Contributor III
Contributor III

Hi Lynn,

Just create a column like below. Let me know if it helps.

LOAD

Picked,

BOH,

if(Picked = BOH, 'TRUE', 'FALSE') as Match

INLINE [

    Picked, BOH

    1, 1

    0, 0

    0, 0

    0, 0

    5, 4

];

Anil_Babu_Samineni

May be?

Count({<picked = {'0'}, BOH={'0'}>} Instance) // Here, I haven't seen any Instance field in your data

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
sam_grounds
Contributor III
Contributor III

=num(count({$<picked={0},BOH={0}>}picked)),'#,##0')

Kushal_Chawda

Please provide enough data to build the logic, here you need to find out instances , so what should be counted as instances, is there any Key field in your data?

sam_grounds
Contributor III
Contributor III

You could just count one of the fields mentioned as outlined in my example above.