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

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
Applicable88
Creator III
Creator III

Subtract counts if both condition are met /same Serialnumber

Hello,

I have following table:

SerialnumberStatus
1111B
1111M
2222B
2222M
3333B
3333M
5432B
1234B

 

I want to count the serialnumbers with status 'B' . Only in case the serialnumber already exist with status 'M' it should be deducted from the first count.

like that: count({$<Status={B}>}serialnumber)- count({$<Status={M}, (serialnumber of  B= seralnumber of M>}serialnumber) 

Is that better solve with If-Statement? can you give me example in if and in set analysis please. 

I hope I explained my problem well. 

Thank you in advance.

11 Replies
Applicable88
Creator III
Creator III
Author

sorry @Taoufiq_Zarra  about the format of the additional columns.

But it the website didn't accept my formatted table from excel . 

and no... in qliksense I left the identifier in the fuction, so it cannot be changed through selections. I aware of that. no filter was on anyway. 

Taoufiq_Zarra
MVP
MVP

@Applicable88  if its the same logic you need:

=sum({<Status={'B'},Serialnumber={"= count({<Status={'M'}>} Status)>0"}>} Value)

and

=sum({<Status={'B'},Serialnumber={"= count({<Status={'M'}>} Status)>0"}>} Value)

if not can you share also the expected output from the attached sample ?

Regards,
Taoufiq ZARRA

"Please LIKE posts and "Accept as Solution" if the provided solution is helpful "

(you can mark up to 3 "solutions") 😉