Qlik Community

Qlik Sense App Development

Discussion board where members can learn more about Qlik Sense App Development and Usage.

joeybird
Contributor II

percentage calculation

Hiya

trying to calculate a number to percentage...

managed to change the format to custom and 0% no problems there, its just my calculation I need help with please?

I have a number of customers every month, and a bar chart that shows these total number of customers per month for a year

e.g Jan 1000 Feb 1500 Mar 1300 ect

but I have calculated too a KPI how many customers had product delivered in 7 days. (done in data load editor and creates the field "Delivered Within 7 Days")

I want to work out a percentage

that e.g in Jan out of total number of customers for the month (this case a 1000) how much in percentage of customers had their product delivered within 7 days

I got a code like this but it just gives me 100% for all months

(count([Delivered Within 7 Days]) )/  count ([customer])

Please help

Kind Regards

Joeybird

1 Solution

Accepted Solutions

Re: percentage calculation

Try this out:

Sum([Delivered Within 7 Days])/Count([customer])

8 Replies

Re: percentage calculation

I understand what you are looking for, but not entirely sure how your data looks, would you be able to share some sample data for Delivered Within 7 Days and Customer columns together with your dimension you are using.

Best,

Sunny

joeybird
Contributor II

Re: percentage calculation

Hiya

sorry cant post as office work... but all I know there is something wrong with the calculation

(count([Delivered Within 7 Days]) )/  count ([customer])

can you please amend so all values show correctly and not all show 100% please

kind regards

joeybird

Re: percentage calculation

What does [Delivered Within 7 Days] column include? Does it say yes and no or does it only have value when its true? Until I know what's the content of that field, I won't know the problem.

Best,

Sunny

joeybird
Contributor II

Re: percentage calculation

Hiya

"Delivered Within 7 Days" field

it contains a 1 if true and 0 if false

kind regards

joeybird

Re: percentage calculation

Try this out:

Sum([Delivered Within 7 Days])/Count([customer])

joeybird
Contributor II

Re: percentage calculation

fab!!!

thank you

kind regards

joeybird

Re: percentage calculation

No problem! I am glad I was able to help.

Best,

Sunny

msmSahaj
New Contributor III

Re: percentage calculation

Hi Sunny,

I have question similar to above calculation.  I need to calculate percentage in measure based on following pre-selected field.

Suppose pre-selected field from below image is  part number, revision letter, serial number  so what is percentage of selected value in unit(percentage calculate as true= true/ true+false)?

 eg: if you choose 30G2305_A(part number) , K(revision letter),  LENCAR3345(serial number) so what are the percentage of true in this combination?  I am adding this percentage in measure.

thanks for helap in advance

 

 

Community Browser