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

Format number within expression

Hi,

How can I limit the number of decimals within my expression?

I have an expression in my chart title, which is supposed to show me 22% but I don't know how to format it, so it shows 0.2212341241 or something. I can of course multiply with 100, but I want it to round off (have no decimals, or just one is also okay).

Here is the title of my gauge chart:

='Credit Utilisation (Limit Spent) - '& Sum (Limit-[OTB (excl. oversell)])/Sum (Limit)*100

13 Replies
Not applicable

use Num FUNC...

Num( Value,'#,##0 ')

=num(Sum (Limit-[OTB (excl. oversell)])/Sum (Limit),'#,##0')

pat_agen
Specialist
Specialist

hi,

wrap your expression with the num() function. Look it up in the help.

num( expression [ , format-code [ , decimal-sep [ , thousands-sep ] ] ] )

The num function formats the expression numerically according to the string given as format-code. Decimal separator and thousands separator can be set as third and fourth parameters. If the parameters 2-4 are omitted, the number format set in the operating system is used.

for the second parameter - the format code - a tip I was given and which works is to go to the chart->properties->number dialgue and copy preferred format with cut and paste it into your num function. The format goes between simple quotes.

hope this helps.

gerhardl
Creator II
Creator II
Author

Thank you very much.

Could someone PLEASE HELP ME report the following. Except for what I say below, I cannot send an email to Jason Long, whenever I click send it just tells me to enter the name of the recipient, which it then just ignores again. Please someone forward this to Jason Long or support or anyone who can help me, I cannot do anything on this site!

Hi Jason,

I'm having big problems with the site - All of the dropdown-links at the top of the page (New, Your Stuff, History, Browse) do not work - at the bottom of the screen the path shows javascript:void(0) and nothing happends when I click teh links. The same thing for replying on threads. I can start a new one, but then I can only reply to it by replying directly to the email notification.

Also, whenever I use brackets in a post to show a field with spaces, when I post it it changes the field name to a hyperlink of the discussion! crazy.

Please look into this or tell me what to do. I also cant mark answers as correct anymore, dont know if this is just due to the new site or what.

Thanks,

Gerhard

christian77
Partner - Specialist
Partner - Specialist

Hi:

These '#,##0' formating tails can be picked up from any Number dialog, so you won't have to remember them or hit the manual. Look at the picture.

Formats.jpg

mvaugusto
Creator
Creator

I was looking for this '#,##0'

jduenyas
Specialist
Specialist

All of the posts above are correct. However if you want to show the percent sign appended to the number use this formating string: '#,##0%'  (i.e. Num(<Expression or value>,'#,##0%')

Not applicable

Just a word of caution, when using the '%' remember that qlikview automatically multiplies the number by a 100. So the actual evaluated value of the expression must be in decimal

christian77
Partner - Specialist
Partner - Specialist

Hi.

To solve % situation, load your % per one, that means, the real number, not the view.

45%   load as 0.45.

Otherwise, you need to divide by 100 everytime.

evansabres
Specialist
Specialist

Hello -

Use

=num(AVG([Total CTR]), '#.##%')

Best