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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Percentage calculation using variables

I have the following two variables with the values tested in text boxes:

Screen Shot 2015-11-23 at 17.16.13.pngScreen Shot 2015-11-23 at 17.15.57.png

I am trying to get the % change from current versus the previous as follows:

=$(vSetCurrentAvRevRx)/$(vSetPreviousAvRevRx) - 1 and formatted as a percentage in number tab option

which should give -1.56% but i am getting a different value (-.99999).  My expression above should be the problem.  Kindly assist.

Regards

Message was edited by: Christopher Chitemerere

18 Replies
Mark_Little
Luminary
Luminary

Hi,

Try this

=NUM($(vSetCurrentAvRevRx)/$(vSetPreviousAvRevRx) *- 1,'#,##0.00')


Mark

lironbaram
Partner - Master III
Partner - Master III

hi

if your variable are holding numbers i.e they variable expression starts with '=' sign

you might want to try num(vSetCurrentAvRevRx/vSetPreviousAvRevRx - 1 ,'##0.00%')

Anonymous
Not applicable
Author

Thanks Mark for your contribution. The expression gives a blank result.

Mark_Little
Luminary
Luminary

HI,

Could be like Liron has suggested, try the below.

Mark

Anonymous
Not applicable
Author

Thanks Liron

Your suggestion gives a blank.  The expressions are as follows:

Current

Num((Sum({$<$(vSetMTD)>}[MedAid Amount])) + Num(Sum({$<$(vSetMTD)>}[Shortfall])), '$##,##0.00')/Num(Sum({$<$(vSetMTD)>}Rx), '#,##0')

 

Previous

Num((Sum({$<$(vSetPreviousMonth)>}[MedAid Amount])) + Num(Sum({$<$(vSetPreviousMonth)>}[Shortfall])), '$##,##0.00')/Num(Sum({$<$(vSetPreviousMonth)>}Rx), '#,##0')

Anonymous
Not applicable
Author

hi,

try this:

=num(($(vSetCurrentAvRevRx)/$(vSetPreviousAvRevRx))-1,'# ##0,00 %')


With your expressions, it should be:

Num(

((Sum({$<$(vSetMTD)>}[MedAid Amount]) +Sum({$<$(vSetMTD)>}[Shortfall]))/Sum({$<$(vSetMTD)>}Rx))

/

((Sum({$<$(vSetPreviousMonth)>}[MedAid Amount]) + Sum({$<$(vSetPreviousMonth)>}[Shortfall]))/Sum({$<$(vSetPreviousMonth)>}Rx)),

'# ##0,00 %')

Or maybe '# ##0.00 %' it depends on your number format

tamilarasu
Champion
Champion

Hi Christopher,

Try like,

=($(vSetCurrentAvRevRx)/$(vSetPreviousAvRevRx) )- 1

Anonymous
Not applicable
Author

Many thanks, this does not seem to work

Anonymous
Not applicable
Author

Thanks Tamil, i am getting a blank with your suggestions.