Skip to main content
Announcements
Live today at 11 AM ET. Get your questions about Qlik Connect answered, or just listen in. SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
saivina2920
Creator
Creator

How to subtract from one count to another count

I'm using count in two different text boxes. Finally i want to subtract from one count to another.

For example

Textbox1 = Count({<[TO]={'EMP-DESIGN'},[FROM]={"$(vplace)"}>} DISTINCT [EMP_NUM])

Textbox2 = Count({<[FROM]={'EMP-DEISGN'},[TO]={"$(vplace)"}>} DISTINCT [EMP_NUM])

I want in textbox3 = sum(Textbox1 - Textbox2) ==> Otuput....

How to do this...?????

Labels (2)
2 Solutions

Accepted Solutions
sunny_talwar

How about this

Count({<[TO]={'EMP-DESIGN'},[FROM]={"$(vplace)"}>} DISTINCT [EMP_NUM])
-
Count({<[FROM]={'EMP-DEISGN'},[TO]={"$(vplace)"}>} DISTINCT [EMP_NUM])

View solution in original post

saivina2920
Creator
Creator
Author

no..it's showing as string entire code...
I want to use this in Textbox expression
anything shall i use
equals before count like,
=count (....) - count(...)

View solution in original post

7 Replies
Sergey_Shuklin
Specialist
Specialist

Hello!
There is no refference to the objects in QV. You'll have to use the same expression as you used in Textbox1 and Textbox2.
So in Textbox3 you should place:
sum(Count({<[TO]={'EMP-DESIGN'},[FROM]={"$(vplace)"}>} DISTINCT [EMP_NUM]) - Count({<[FROM]={'EMP-DEISGN'},[TO]={"$(vplace)"}>} DISTINCT [EMP_NUM]))
saivina2920
Creator
Creator
Author

But, It shows Expression OK. but, it's showing error.

pls. find the screenshot..

sunny_talwar

How about this

Count({<[TO]={'EMP-DESIGN'},[FROM]={"$(vplace)"}>} DISTINCT [EMP_NUM])
-
Count({<[FROM]={'EMP-DEISGN'},[TO]={"$(vplace)"}>} DISTINCT [EMP_NUM])
saivina2920
Creator
Creator
Author

no..it's showing as string entire code...
I want to use this in Textbox expression
anything shall i use
equals before count like,
=count (....) - count(...)
sunny_talwar

Yes, you do need the equal, my bad for forgetting it....

saivina2920
Creator
Creator
Author

done..thanks...
sunny_talwar

no problem, I am glad you were able to figure it out 🙂