Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Issue with num format

Hi,

Can someone please help me with the number format? I want to implement 3 significant figures in my dashboard.

Please find the sample dashboard and a screenshot explaining the requirement.

Thank you.

Regards,

Sachin

1 Solution

Accepted Solutions
sunny_talwar

Try this expression:

=If(Len(SubField(Num(Sum(Price), '#,##0.0'), '.', 1)) >= 3, Num(Sum(Price), '#,##0'),

If(Len(SubField(Num(Sum(Price), '#,##0.0'), '.', 1)) = 2, Num(Sum(Price), '#,##0.0'), Num(Sum(Price), '#,##0.00')))


Capture.PNG

View solution in original post

9 Replies
sunny_talwar

Bar for C need to have one decimal and other bars need to be integer? Is that your requirement?

Not applicable
Author

Nope Sunny.

Every time the output should have 3 digits.

If it is 564.324,  it should be displayed as 564.

If it is 0.212,  it should be displayed as 0.21.

sunny_talwar

May be this as your expression:

If(Stock = 'C', Num(Sum(Price), '#,##0.0'), Num(Sum(Price), '#,##0'))

Capture.PNG

sunny_talwar

Oh okay, that makes sense

Not applicable
Author

question

I can see how the first bar is rounded to 549 (from 548.806) but how come the last bar was still has a decimal?

Is bar C supposed to be formatted differently?  what about bar b - in the example they have the same values but what about if they have decimals in them?

Not applicable
Author

Hi Adam,

Every time the output should have 3 digits.

If it is 564.324,  it should be displayed as 564.

If it is 0.212,  it should be displayed as 0.21.

sunny_talwar

Try this expression:

=If(Len(SubField(Num(Sum(Price), '#,##0.0'), '.', 1)) >= 3, Num(Sum(Price), '#,##0'),

If(Len(SubField(Num(Sum(Price), '#,##0.0'), '.', 1)) = 2, Num(Sum(Price), '#,##0.0'), Num(Sum(Price), '#,##0.00')))


Capture.PNG

Not applicable
Author

based on that explanation, it sounds like sunny's first suggestion would ensure that, regardgless of the stock, since it is looking at the length of the field for each stock, and not looking at the values differently

Not applicable
Author

I updated the qvw to have stock d and are showing side by side how it looks unformatted and then applied sunny's first formatting - If I understand, this is what you are looking for