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

Announcements
Qlik GA: Multivariate Time Series in Qlik Predict: Get Details
cancel
Showing results for 
Search instead for 
Did you mean: 
sweens78
Creator
Creator

Adding percentges together but getting a decimal

Hi Guys

I want to add up percentages as seen below but when I go to add I'm getting the decimal point rather than percentage if that makes sense.

So for example instead of returning 9.18% (total of both) it is returning  0.918.

I know it probably the code I need to change?

Any Ideas

Thanks Martin

7 Replies
sunny_talwar

Is it giving you 0.918 or 0.0918? Because a decimal representation of 9.18% will be 0.0918. If this is what you see, then all you need is a Num function around your expression

Num(Expression, '#.##%')

sweens78
Creator
Creator
Author

Hi Sunny apologies I never included the below, Im still getting the decimal point

=Num((count(if (SelfHarmAct_ID= '1' and SubstanceMisuseAlsoAFactor = '1', NEWKEYID))-Count(if (SelfHarmAct_ID = '1' and SubstanceMisuseAlsoAFactor= '1', PatientsNotAssessed_ID)))/(Count(NEWKEYID)-Count(PatientsNotAssessed_ID)),'##.##%')
+
Num((count(if (SelfHarmAct_ID= '2' and SubstanceMisuseAlsoAFactor = '1', NEWKEYID))-Count(if (SelfHarmAct_ID = '2' and SubstanceMisuseAlsoAFactor= '1', PatientsNotAssessed_ID)))/(Count(NEWKEYID)-Count(PatientsNotAssessed_ID)),'##.##%')

sunny_talwar

Try this

=Num(

((Count({<SelfHarmAct_ID = {'1'}, SubstanceMisuseAlsoAFactor = {'1'}>} NEWKEYID) - Count({<SelfHarmAct_ID = {'1'}, SubstanceMisuseAlsoAFactor = {'1'}>} PatientsNotAssessed_ID))/(Count(NEWKEYID) - Count(PatientsNotAssessed_ID))
+

(Count({<SelfHarmAct_ID = {'2'}, SubstanceMisuseAlsoAFactor = {'1'}>} NEWKEYID) - Count({<SelfHarmAct_ID = {'2'}, SubstanceMisuseAlsoAFactor = {'1'}>} PatientsNotAssessed_ID))/(Count(NEWKEYID) - Count(PatientsNotAssessed_ID)))

,'##.##%')

sweens78
Creator
Creator
Author

Sunny what can I say,

Brilliant that's working!

Martin

sunny_talwar

Awesome

sweens78
Creator
Creator
Author

Sunny apologies If I was to add another line as below, am I wrong with my brackets?

=Num(

((
Count({<SelfHarmAct_ID = {'1'}, SubstanceMisuseAlsoAFactor = {'1'}>} NEWKEYID) - Count({<SelfHarmAct_ID = {'1'}, SubstanceMisuseAlsoAFactor = {'1'}>} PatientsNotAssessed_ID))/(Count(NEWKEYID) - Count(PatientsNotAssessed_ID))
+

(
Count({<SelfHarmAct_ID = {'2'}, SubstanceMisuseAlsoAFactor = {'1'}>} NEWKEYID) - Count({<SelfHarmAct_ID = {'2'}, SubstanceMisuseAlsoAFactor = {'1'}>} PatientsNotAssessed_ID))/(Count(NEWKEYID) - Count(PatientsNotAssessed_ID)))
+
(
Count({<SelfHarmAct_ID = {'2'}, SubstanceMisuseAlsoAFactor = {'1'}>} NEWKEYID) - Count({<SelfHarmAct_ID = {'2'}, SubstanceMisuseAlsoAFactor = {'1'}>} PatientsNotAssessed_ID))/(Count(NEWKEYID) - Count(PatientsNotAssessed_ID)))

,'##.##%'
)

sunny_talwar

Yes... try this

=Num(
(

(Count({<SelfHarmAct_ID = {'1'}, SubstanceMisuseAlsoAFactor = {'1'}>} NEWKEYID) - Count({<SelfHarmAct_ID = {'1'}, SubstanceMisuseAlsoAFactor = {'1'}>} PatientsNotAssessed_ID))/(Count(NEWKEYID) - Count(PatientsNotAssessed_ID))
+
(Count({<SelfHarmAct_ID = {'2'}, SubstanceMisuseAlsoAFactor = {'1'}>} NEWKEYID) - Count({<SelfHarmAct_ID = {'2'}, SubstanceMisuseAlsoAFactor = {'1'}>} PatientsNotAssessed_ID))/(Count(NEWKEYID) - Count(PatientsNotAssessed_ID))
+
(Count({<SelfHarmAct_ID = {'2'}, SubstanceMisuseAlsoAFactor = {'1'}>} NEWKEYID) - Count({<SelfHarmAct_ID = {'2'}, SubstanceMisuseAlsoAFactor = {'1'}>} PatientsNotAssessed_ID))/(Count(NEWKEYID) - Count(PatientsNotAssessed_ID))

)
,'##.##%')