Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements
If you are a Qlik Insight Bot user, join this collaborative group: JOIN GROUP
Highlighted
New Contributor III

How to round numbers.... using the num() function in a text object.

I'm working on a dashboard & I need to show CYTD Sales in a text object.   The formula I'm using is working but now I need to round the number down.   Currently I have $69,181,750.6 I need to round this number to 69.2 MRoun

1 Solution

Accepted Solutions
Highlighted

Re: How to round numbers.... using the num() function in a text object.

May be just this

=Num(Round(Sum({<year=,month=,quarter=,_CYTD_Flag={1}>} [# Amount])/1000000, 0.1), '$#.0M')

or

=Num(Round(Sum({<year=,month=,quarter=,_CYTD_Flag={1}>} [# Amount])/1000000, 0.1), '$#.0') & 'M'

View solution in original post

6 Replies
Highlighted

Re: How to round numbers.... using the num() function in a text object.

May be like this

=Round(69181750.6/1000000, 0.1)

Highlighted
Valued Contributor

Re: How to round numbers.... using the num() function in a text object.

Use Round() function.

round([CYTD Sales],100000)

after that yuo can divide by 1000000 to obtain 69.2MRoun

Highlighted
New Contributor III

Re: How to round numbers.... using the num() function in a text object.

Sunny,

Thanks for the help I appreciate the quick response.

John Worth

Upper Lakes Foods, Inc.

801 Industry Avenue, Cloquet, MN 55720

p.800-879-1265 ext. 4278 l f.800-238-6456

www.upperlakesfoods.com<https://urldefense.proofpoint.com/v2/url?u=http-3A__www.upperlakesfoods.com_&d=AwMFAg&c=Y1FPPfdI3qXd_9qVC_KBeZmXgnMS0xZibNIJZa39qG4&r=xr1IuEKVGJ9RIIyJ5eVTKiT49Wq75UFOJssniuBA2QA&m=5MFduC0NPPBvAEuflC5Zr_fkVsJIXm41KiHfdan1oMY&s=TuZ90iSqXX2DozspS0AL3NHLxiPspL0rNP6_P9d13YU&e=>

<https://urldefense.proofpoint.com/v2/url?u=https-3A__www.facebook.com_upperlakesfoods&d=AwMFAg&c=Y1FPPfdI3qXd_9qVC_KBeZmXgnMS0xZibNIJZa39qG4&r=xr1IuEKVGJ9RIIyJ5eVTKiT49Wq75UFOJssniuBA2QA&m=5MFduC0NPPBvAEuflC5Zr_fkVsJIXm41KiHfdan1oMY&s=Aw1vGtvVLIwF4QLTBDRKu-YpOaLWkhQfPTZGWqMJtzk&e=> <https://urldefense.proofpoint.com/v2/url?u=https-3A__plus.google.com_-26-2343-3BUpperlakesfoods_posts&d=AwMFAg&c=Y1FPPfdI3qXd_9qVC_KBeZmXgnMS0xZibNIJZa39qG4&r=xr1IuEKVGJ9RIIyJ5eVTKiT49Wq75UFOJssniuBA2QA&m=5MFduC0NPPBvAEuflC5Zr_fkVsJIXm41KiHfdan1oMY&s=HYJT8Mq9naGNSSO_e3t8ioOliXZgOgRCig3SNJ6u2Hg&e=> <https://urldefense.proofpoint.com/v2/url?u=https-3A__twitter.com_UpperLakesFoods&d=AwMFAg&c=Y1FPPfdI3qXd_9qVC_KBeZmXgnMS0xZibNIJZa39qG4&r=xr1IuEKVGJ9RIIyJ5eVTKiT49Wq75UFOJssniuBA2QA&m=5MFduC0NPPBvAEuflC5Zr_fkVsJIXm41KiHfdan1oMY&s=s2GiATMqqCz7RvEIaGaQK-MYexeQk_RIDa1u63lwCyQ&e=> <https://urldefense.proofpoint.com/v2/url?u=http-3A__www.pinterest.com_upperlakesfoods_&d=AwMFAg&c=Y1FPPfdI3qXd_9qVC_KBeZmXgnMS0xZibNIJZa39qG4&r=xr1IuEKVGJ9RIIyJ5eVTKiT49Wq75UFOJssniuBA2QA&m=5MFduC0NPPBvAEuflC5Zr_fkVsJIXm41KiHfdan1oMY&s=Ywe4h8zB3YcGvkoziicDm1toTq9XqfaQtp2745Jxqmg&e=> <https://urldefense.proofpoint.com/v2/url?u=https-3A__www.linkedin.com_company_upper-2Dlakes-2Dfoods-2Dinc.&d=AwMFAg&c=Y1FPPfdI3qXd_9qVC_KBeZmXgnMS0xZibNIJZa39qG4&r=xr1IuEKVGJ9RIIyJ5eVTKiT49Wq75UFOJssniuBA2QA&m=5MFduC0NPPBvAEuflC5Zr_fkVsJIXm41KiHfdan1oMY&s=C1_s6vVFw30Xssy6lNfi_Oo5Tyntb6An1dx5ChAsvTo&e=>

Highlighted
New Contributor III

Re: How to round numbers.... using the num() function in a text object.

Michele,

Here's my current text , how would I incorporate your solution in the expression?

=num((sum({<year=,month=,quarter=,_CYTD_Flag={1}>} [# Amount])/1000000),'$##.0') & ' M '

= 69.2 M

Highlighted

Re: How to round numbers.... using the num() function in a text object.

May be just this

=Num(Round(Sum({<year=,month=,quarter=,_CYTD_Flag={1}>} [# Amount])/1000000, 0.1), '$#.0M')

or

=Num(Round(Sum({<year=,month=,quarter=,_CYTD_Flag={1}>} [# Amount])/1000000, 0.1), '$#.0') & 'M'

View solution in original post

New Contributor III

Re: How to round numbers.... using the num() function in a text object.

Sunny,

Thanks both scripts worked like a charm.   Awesome!