Skip to main content
Announcements
Qlik Connect 2025: 3 days of full immersion in data, analytics, and AI. May 13-15 | Orlando, FL: Learn More
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Round numbers (%) in expression

Hi,

I try get MAX values in bar chart for each category (picture below). I got it, but I have a problem with round numbers. May I ask for help?

This is code, which I need for MAX values in Category in %. It works fine.

=if(RANK(AGGR(Sum({<DATUM_ID = {">=$(=datum_od) <=$(=datum_do)"}>} PRIJATE)/ Sum(TOTAL <AREA> {<DATUM_ID = {">=$(=datum_od) <=$(=datum_do)"}>} PRIJATE) ,AREA, TYPE)) = 1,rgb(80,80,80))


p.s. "DATUM_ID" means DATE

1.JPG

1 Solution

Accepted Solutions
sunny_talwar

Show Value just specify which value to show, but to format you either need to format your actual expression using Num() function or go to Numbers tab to format it.

Capture.PNG

Also, show value should work with this only

Rank(Sum({<DATUM_ID = {">=$(=datum_od) <=$(=datum_do)"}>} PRIJATE)/ Sum(TOTAL <AREA> {<DATUM_ID = {">=$(=datum_od) <=$(=datum_do)"}>} PRIJATE)) = 1

View solution in original post

7 Replies
sunny_talwar

You are looking to show 94,339622641509% as 94%? May be this:

Num(Sum({<DATUM_ID = {">=$(=datum_od) <=$(=datum_do)"}>} PRIJATE)/ Sum(TOTAL <AREA> {<DATUM_ID = {">=$(=datum_od) <=$(=datum_do)"}>} PRIJATE), '##%')

Or on the Number's tab of the chart properties you can select Integer and then check 'Show in Percent (%)'

Not applicable
Author

I edited my code. It is right:

=if(RANK(AGGR(Sum({<DATUM_ID = {">=$(=datum_od) <=$(=datum_do)"}>} PRIJATE)/ Sum(TOTAL <AREA> {<DATUM_ID = {">=$(=datum_od) <=$(=datum_do)"}>} PRIJATE) ,AREA, TYPE)) = 1,rgb(80,80,80))

but  Num(..., '##%') doesn't work

sunny_talwar

This code is used for background color, right?

=if(RANK(AGGR(Sum({<DATUM_ID = {">=$(=datum_od) <=$(=datum_do)"}>} PRIJATE)/ Sum(TOTAL <AREA> {<DATUM_ID = {">=$(=datum_od) <=$(=datum_do)"}>} PRIJATE) ,AREA, TYPE)) = 1,rgb(80,80,80))

You don't need formatting for color. You need this in your original expression.....

Not applicable
Author

No, it is code for Show Value.

2.JPG

swuehl
MVP
MVP

You would need to set the format for your expression ( Sum({<DATUM_ID = ....), not for the expression attribute 'Show Value'.

Hence add the Num() part to your original expression or set the format accordingly on number tab.

sunny_talwar

Show Value just specify which value to show, but to format you either need to format your actual expression using Num() function or go to Numbers tab to format it.

Capture.PNG

Also, show value should work with this only

Rank(Sum({<DATUM_ID = {">=$(=datum_od) <=$(=datum_do)"}>} PRIJATE)/ Sum(TOTAL <AREA> {<DATUM_ID = {">=$(=datum_od) <=$(=datum_do)"}>} PRIJATE)) = 1

Not applicable
Author

Thank you Sunny. You are right.

Show Value work only with this:

Rank(Sum({<DATUM_ID = {">=$(=datum_od) <=$(=datum_do)"}>} PRIJATE)/ Sum(TOTAL <AREA> {<DATUM_ID = {">=$(=datum_od) <=$(=datum_do)"}>} PRIJATE)) = 1


and in Number tab I add Format Pattern 0%. Now this is according to my idea.