Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

showing percent in Y- axis

I have requirement to show the Y axis of line chart in percent, similar to Mekko Chart.

With some simple data I simply used count(data)/count(total(data) for the expression but  when I used it in a different larger sample with the following expression :


Count({<Latency = {'<600'}, [Throughput (Kbps)] = {'<1000'}>}DISTINCT [Hardware Id])/Count(DISTINCT([Hardware Id]))

and changed the number to integer and selected show in percent under number tab, the total number does not result in 100%.  In this example it shows below 100%, and real data I had even more than 100%. Any hint how to simply make it like Mekko chart so that it is always showing 100%.

Capture.JPG

This is a continuation of the discussion from different thread https://community.qlik.com/message/1064903?et=watches.email.thread#1064903

The expression seems to be correct and theoretically all numbers should add up in 100%. Any clue ?

17 Replies
bindu_apte
Creator III
Creator III

Hi,

Try this code.

if(IsNull(num(count(DISTINCT {<Latency = {'<600'}, [Throughput (Kbps)] = {'>1000'}>} [Hardware Id]),'###.##%')),

'0.00%',

num(count(DISTINCT {<Latency = {'<600'}, [Throughput (Kbps)] = {'<1000'}>} [Hardware Id]),'###.##%')

sushil353
Master II
Master II

Just go to chart property>Number>select integer option and then click on percentage.

HTH

sushil

Anonymous
Not applicable
Author

Hi,

I did that at first place (selected number and integer option and click on percentage).  As explained in initial posting the issue is not showing percentage itself but rather the total of the values on Y axis is not  100%. I need to show the stacked line charts where the accumulated value is 100%, similar to Mekko chart.

I tried

Count({<Latency = {'<600'}, [Throughput (Kbps)] = {'<1000'}>}DISTINCT [Hardware Id])/Count(DISTINCT([Hardware Id]))  which basically count the desired part divided by total numbers for each quadrant but the total on the Y axis is not 100%.

The code suggested by Bindu is not working either - the percentage is showing the order of thousands.

Any other suggestions?

sunny_talwar

Like this

Capture.PNG

sunny_talwar

I divided the expressions by:

RangeSum(

Count({<Latency = {'<600'}, [Throughput (Kbps)] = {'<1000'}>}DISTINCT [Hardware Id]),

Count({<Latency = {'<600'}, [Throughput (Kbps)] = {'>=1000'}>}DISTINCT [Hardware Id]),

Count({<Latency = {'>=600'}, [Throughput (Kbps)] = {'<1000'}>}DISTINCT [Hardware Id]),

Count({<Latency = {'>=600'}, [Throughput (Kbps)] = {'>=1000'}>}DISTINCT [Hardware Id]))

Anonymous
Not applicable
Author

Hi Sunny,

That's is what I want, but when I applied your code above to my test file

and my real file the axis did not add up to 100% or 1. Any hint?

Thanks!

sunny_talwar

I don't really know what is different between your original file and this sample. How many expressions and dimensions do you have in your original file?

Anonymous
Not applicable
Author

Hi,

Original file has one dimension and 4 expressions.

Sent from my iPhone

sunny_talwar

Try these as your expressions:

1) Expression1 / RangeSum(Expression1, Expression2, Expression3, Expression4)

2) Expression2 / RangeSum(Expression1, Expression2, Expression3, Expression4)

3) Expression3 / RangeSum(Expression1, Expression2, Expression3, Expression4)

4) Expression4 / RangeSum(Expression1, Expression2, Expression3, Expression4)

Replace the expression placeholder with your original expressions and see if that fixes the issue for you