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: 
sweens78
Creator
Creator

Subtracting to values

Hi Guys

I'm try to subtract the two formula below when I do them individually I get correct answer but when I try to then subtract the two formula my answer is wrong, out by 4!  Any ideas where I may be going wrong? Think I may have too many counts?

Formula 1 count(if(Interventions_ID='4', NEWKEYID))-Count(if( Interventions_ID= '4', PatientsNotAssessed_ID)) correct answer

Formula 2 count(if(Interventions_ID='5', NEWKEYID))-Count(if( Interventions_ID= '5', PatientsNotAssessed_ID)) correct answer

subtract the two?? Getting wrong answer

count(if(Interventions_ID='4', NEWKEYID))-Count(if( Interventions_ID= '4', PatientsNotAssessed_ID))-count(if(Interventions_ID='5', NEWKEYID))-Count(if( Interventions_ID= '5', PatientsNotAssessed_ID))

1 Solution

Accepted Solutions
rubenmarin

Hi Martin, I think is a parenthesys issue:

count(if(Interventions_ID='4', NEWKEYID))-Count(if( Interventions_ID= '4', PatientsNotAssessed_ID))-(count(if(Interventions_ID='5',NEWKEYID))-Count(if( Interventions_ID= '5', PatientsNotAssessed_ID)))

View solution in original post

5 Replies
rubenmarin

Hi Martin, I think is a parenthesys issue:

count(if(Interventions_ID='4', NEWKEYID))-Count(if( Interventions_ID= '4', PatientsNotAssessed_ID))-(count(if(Interventions_ID='5',NEWKEYID))-Count(if( Interventions_ID= '5', PatientsNotAssessed_ID)))

trdandamudi
Master II
Master II

Can you please attach a sample app ? or give a try with the below:

count({<Interventions_ID={4}>}, NEWKEYID)-Count({<Interventions_ID={4}>}, PatientsNotAssessed_ID)-count({<Interventions_ID={5}>}, NEWKEYID)-Count({<Interventions_ID={5}>}, PatientsNotAssessed_ID)

sweens78
Creator
Creator
Author

Great Job Ruben!

sweens78
Creator
Creator
Author

Ruben,

I just want to get a percentage of the above as well im trying to do it this way but still no good any

thoughts?

=NUM((count(if(Interventions_ID='4', NEWKEYID))-Count(if( Interventions_ID= '4', PatientsNotAssessed_ID))-(count(if(Interventions_ID='5',NEWKEYID))-Count(if( Interventions_ID= '5', PatientsNotAssessed_ID))) / ((Count(NEWKEYID)-Count(PatientsNotAssessed_ID)),'##.##%'))

rubenmarin

Hi, if you want the percentaje of Intervention_ID 4 over the ID 5, the second part of division needs the same check to retrieve only the ID 5.

(count(if(Interventions_ID='4', NEWKEYID))-Count(if( Interventions_ID= '4', PatientsNotAssessed_ID))-(count(if(Interventions_ID='5',NEWKEYID))-Count(if( Interventions_ID= '5', PatientsNotAssessed_ID)))) / (count(if(Interventions_ID='5',NEWKEYID))-Count(if( Interventions_ID= '5', PatientsNotAssessed_ID)))

Also, the use of 'If()' in this expression can be improved using set analysis:

"count(if(Interventions_ID='4', NEWKEYID))" can be "Count({<Interventions_ID={'4'}>} NEWKEYID)"