Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Error in expression values(minus sign for 0 value)


hello

I have derived one metrics in report.

Sales growth=(current sales-prev sales)/(prev sales)

In report current and prev values are same. So ideally it should display 0.0%

But it is displaying -0.0%.

There should not be any sign for 0 value.

Please find the attached image.

Thanks in Advance !!!

9 Replies
MK_QSL
MVP
MVP

if you make these numbers to two decimal, there could be difference.

please check and let us know

vikasmahajan

Go to Numbers -> Decimal -> 2 digit  then it will show some fractional value it is not zero in your case.

Vikas

Hope this resolve your issue.
If the issue is solved please mark the answer with Accept as Solution & like it.
If you want to go quickly, go alone. If you want to go far, go together.
Not applicable
Author

I have checked upto 5 decimals,but values are exact same.

MK_QSL
MVP
MVP

You can use below expression...

If(current sales = prev sales , 0, ((current sales-prev sales)/(prev sales)))

Not applicable
Author

Instead of percentage in the Numbers tab, tey showing it decimals or number format.

or you can try below:

(num(current sales)-num(prev sales))/(num(prev sales))

Not applicable
Author

I can't hardcode the values. Is there any other option for the same.

Or is anyone have idea that why the 0 is getting minus(-) sign.

Not applicable
Author

I have tried by the same way.

I have changed the decimal format to number. But it is displaying -0.

MK_QSL
MVP
MVP

have you used...

If(current sales = prev sales , 0, ((current sales-prev sales)/(prev sales)))

jonathandienst
Partner - Champion III
Partner - Champion III

Hi

This is a rounding error from the floating point arithmetic. Use Round() to eliminate:

     =Round((current sales-prev sales)/(prev sales), 0.1)

HTH

Jonathan

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein