Qlik Community

QlikView Creating Analytics

Discussion Board for collaboration related to Creating Analytics for QlikView.

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

Re: Error in expression values(minus sign for 0 value)

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

please check and let us know

vikasmahajan
Honored Contributor III

Re: Error in expression values(minus sign for 0 value)

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

Vikas

Not applicable

Re: Error in expression values(minus sign for 0 value)

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

Re: Error in expression values(minus sign for 0 value)

You can use below expression...

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

Not applicable

Re: Error in expression values(minus sign for 0 value)

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

Re: Error in expression values(minus sign for 0 value)

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

Re: Error in expression values(minus sign for 0 value)

I have tried by the same way.

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

Re: Error in expression values(minus sign for 0 value)

have you used...

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

MVP
MVP

Re: Error in expression values(minus sign for 0 value)

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
Community Browser