Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
joeybird
Creator III
Creator III

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
sunny_talwar

Try this out:

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

View solution in original post

8 Replies
sunny_talwar

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
Creator III
Creator III
Author

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

sunny_talwar

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
Creator III
Creator III
Author

Hiya

"Delivered Within 7 Days" field

it contains a 1 if true and 0 if false

kind regards

joeybird

sunny_talwar

Try this out:

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

joeybird
Creator III
Creator III
Author

fab!!!

thank you

kind regards

joeybird

sunny_talwar

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

Best,

Sunny

msmSahaj
Contributor III
Contributor III

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