Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Convert negative number value

Hi,

How do we do for converting negative number? i have some value like -1.78967*******e-16, i want this to be displayed either as 0 or some number with just 2 decimals (like -1.78f). I tried using the above function. But it doesn't work. Thanks in advance.

Thanks & Regards

Priyanka

1 Solution

Accepted Solutions
adamdavi3s
Master
Master

Can you simply round your formula in this case?

Round(sum(value),0.01)

View solution in original post

14 Replies
Anil_Babu_Samineni

Can you eloberate more on this?

Why can't simply Number format with 2 decimals. May be provide with more input values and expected result

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
veeranj
Creator II
Creator II

Hi ,

Try using fabs(number) to convert negative to postive values .

Try round(number) to  to convert number to the nearest integer or nearest decimal .

round(-1.78965689,10) will give 0 as output .

check round function option .

Thanks,

Veera

Frank_Hartmann
Master II
Master II

try using Round() function or try like this:

num((-1.78967*******e-16),'##.##')

hope this helps

sarvesh
Creator III
Creator III

Hi..Priyanka,

You can try below mentioned code:

NUM((SUM(profit)/SUM(amount) -1) * 100, '#,##0.0% ;(#,##0.0%)')



Please remember to mark this as "helpful" & "correct answer" if your query has been solved.

This will help users identify the answers should they come across this thread in the future.

Regard's

Sarvesh Srivastava

adamdavi3s
Master
Master

It depends on where you are displaying this number?

If in a chart then you should simply be able to alter the display option on the 'number' tab.

If in a textbox or title or something then you will need to use one of the formula mentioned above

Not applicable
Author

Hello All,

Thanks for the response. To explain it further, I have a bar chart with many values as below:

-1.78967********e-16

-0.28

-0.31

-1.00

I have formatted the number to show only 2 decimal places. It works fine for all the values except the exponent value. I want to show the exponent(-1.78967********e-16) as 0. so, my data in bar should look like

0

-0.28

-0.31

-1.00

Hope this explanation helps. Thanks in advance.

sarvesh
Creator III
Creator III

@piyanka - Please mark this as "helpful" & "correct answer" if your query has been solved.

This will help users identify the answers should they come across this thread in the future.



Regard's

Sarvesh Srivastava

adamdavi3s
Master
Master

quite clearly the issue isn't solved?

adamdavi3s
Master
Master

Can you simply round your formula in this case?

Round(sum(value),0.01)