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

How to limit the decimal in expression

Hi All,

I am using the following expression in table chart to find total. Based on the dimension (cyclic group) selection the expression work. For the  1st dimension the value will be shown in $ and for 2nd it will be in num. But I want to limit the decimal in the expression itself. How can I do this?

=If(GetCurrentField([Report10])= '=' & Chr(39) & 'Spend' & Chr(39),money(sum([Amount To Pay LC]), [Vendor Name], Month), num(Count([Invoice Number]), [Vendor Name], Month))

Please suggest a solution.

I have tried the below code, but it is not working

=If(GetCurrentField([Report10])= '=' & Chr(39) & 'Spend' & Chr(39),money(sum([Amount To Pay LC]), [Vendor Name], Month), num(Count([Invoice Number]), [Vendor Name], Month,'#,##0'))

Regards,

Gerard

6 Replies
giakoum
Partner - Master II
Partner - Master II

num(

If(GetCurrentField([Report10])= '=' & Chr(39) & 'Spend' & Chr(39),money(sum([Amount To Pay LC]), [Vendor Name], Month), num(Count([Invoice Number]), [Vendor Name], Month))

, '#,##0.000')

for 3 decimals

use #,##0.0000 for 4 etc

Not applicable
Author

Hi,

Go to the chart Properties-> Number Tab-> select Money for 1st exp. and Fixed to (Number format setting) for the 2nd Exp. and put a number for decimal value.

Hope it will help.

Regards

Apurva

Not applicable
Author

Hi ,

When i apply your formula we can limit the decimal. But ''money(sum([Amount To Pay LC]), [Vendor Name], Month)" output is not showing the $ symbol. Because we are applying NUM () for the whole expression.

Regards,

Gerard

Not applicable
Author

Hi Apurva,

I am using a single expression. Based on the dimension selection the expression will show the output either as $ or Number.

=If(GetCurrentField([Report10])= '=' & Chr(39) & 'Spend' & Chr(39),money(sum([Amount To Pay LC]), [Vendor Name], Month), num(Count([Invoice Number]), [Vendor Name], Month))

Regards,

Gerard

giakoum
Partner - Master II
Partner - Master II

Sorry was not paying attention.

If(GetCurrentField([Report10])= '=' & Chr(39) & 'Spend' & Chr(39),

num(sum([Amount To Pay LC]), [Vendor Name], Month, '£#,##0.00;-£#,##0.00'),

num(Count([Invoice Number]), [Vendor Name], Month, '#,##0.00')

)

Hope this helps!

Not applicable
Author

Thanks .... It is working