
Re: Number format in espression
Stefan Wühl Nov 8, 2011 9:28 AM (in response to rizo98)I don't think that there is a format code for that (or maybe I just don't know. In some objects, there is something like you want, e.g. with the number formatting in bar chart objects).
A general expression could probably look like:
=num( sum(amount) /pow(1000,floor(log10(sum(amount))/3)),'##0.000')
& pick(floor(log10(sum(amount))/3)+1,'',' K',' M',' G',' T')
where you should replace sum(amount) by your actual number calculation you want to format and ' K', ' M' etc. could be replaced by ' thousand', ' million' ... or whatever you like.
Hope this helps,
Stefan
edit: if your sum could be negative, you probably need something like
=num( sum(amount) /pow(1000,floor(log10(fabs(sum(amount)))/3)),'##0.000')
& pick(floor(log10(fabs(sum(amount)))/3)+1,'',' K',' M',' G',' T')

Number format in espression
rizo98 Nov 8, 2011 9:19 AM (in response to Stefan Wühl )thanks swuehl.
my objective is to do it in anexpression.
maybe this is not a thread for New To QlikView?! :))

Re: Number format in espression
Stefan Wühl Nov 8, 2011 9:36 AM (in response to rizo98)So maybe like this:
='Volume  '&
num( sum(total vol) /pow(1000,floor(log10(fabs(sum(total vol)))/3)),'##0.000')
& pick(floor(log10(fabs(sum(total vol)))/3)+1,'',' thousand',' million',' billion',' trillion')
&' / '&
num( sum({1} total vol) /pow(1000,floor(log10(fabs(sum({1} total vol)))/3)),'##0.000')
& pick(floor(log10(fabs(sum({1} total vol)))/3)+1,'',' thousand',' million',' billion',' trillion')
Hope I haven't made a typo now.
And I just reread you OP and saw your second request:
='Share  '& num(Sum(TOTAL vol)]) / Sum({1}TOTAL vol),' ##0.0%')
Hope this helps,
Stefan

Re: Number format in espression
rizo98 Nov 8, 2011 9:59 AM (in response to Stefan Wühl )thanks you Stefan.
I will try it out tonight if I have time and will let you know how I get on.

Re: Number format in espression
rizo98 Nov 8, 2011 5:23 PM (in response to Stefan Wühl )good news.
It worked.
I had to tag Vol as [vol] and it did the trick.
here are the syntax.
='Vol  '& num( sum(total [Vol]) /pow(1000,floor(log10(fabs(sum(total [Vol])))/3)),'##0.000') & pick(floor(log10(fabs(sum(total [Vol])))/3)+1,'',' thousand',' million',' billion',' trillion')
&' / '&
num( sum({1} total [Vol]) /pow(1000,floor(log10(fabs(sum({1} total [Vol])))/3)),'##0.000') &
pick(floor(log10(fabs(sum({1} total [Vol])))/3)+1,'',' thousand',' million',' billion',' trillion')
='Share = '&num(sum( [Vol]) / sum({1} total [Vol]),'##0.0%')
many thanks Stefan


