Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
qlikmpate0
Creator II
Creator II

Problem calculating correct percentages

I have a straight table, of trade, no of customers and sales and units.

I'm trying to calculate the % of sales and units using this expression, but getting incorrect figures for %Units and %Sales(see below)

this is the expression I'm using for %units - (Sum([Qty])/(sum([Qty - TOTAL - Present])*100))

and for %sales I'm using  (sum([Sales $]/[Sales - TOTAL - Present]))*100

example of %units

class of trade total unit/total units * 100 to get % units

eg 79,728/43856,231 * 100 = 0.182%

Do I need to put it in my script, of calculate as an expression?

      

Class of TradeNo of CustomersTotal UnitsTotal Sales% Units% Sales
AGENCY1979,728247,6431.49%2.07%
DECORATOR702,064,4814,535,47412.38%16.86%
DISTRIBUTOR9838,485,801108,168,46667.51%69.18%
MANUFACTURER352,531138,689.11%.11%
RETAIL9412,017356,427.38%.51%
WHOLESALE452,433,5734,398,9526.76%8.17%
-33328,100675,87811.36%3.09%
27743,856,231118,521,528100.00%100.00%

so confused on where I'm going wrong can someone relieve my misery.

Thanks in advance.

regards

M

22 Replies
vvira1316
Specialist II
Specialist II

For someone to help you may be you can share just masked granular data file without the Qlik app. Also provide what is your expected output.

shiveshsingh
Master
Master

May be someone else can help..thanks

qlikmpate0
Creator II
Creator II
Author

How can I do that?

qlikmpate0
Creator II
Creator II
Author

these are the results I'm expecting

where %Units = total unit per trade/total units * 100

       % sales - total sales per trade/total sales *100 this is my calculation.

Class of TradeNo of CustomersTotal UnitsTotal Sales%Units%sales
AGENCY1979,728247,6430.18%0.21%
DECORATOR702,064,4814,535,4744.71%3.83%
DISTRIBUTOR9838,485,801108,168,46687.75%91.26%
MANUFACTURER352,531138,6890.12%0.12%
RETAIL9412,017356,4270.94%0.30%
WHOLESALE452,433,5734,398,9525.55%3.71%
-33328,100675,8780.75%0.57%
27743,856,231118,521,528
sunny_talwar

What do you see when you use this as an expression

Sum(TOTAL [Qty])

qlikmpate0
Creator II
Creator II
Author

I see the value 29056104 for all rows

vvira1316
Specialist II
Specialist II

Hi Mina,

I saw the table and have some idea about the calculation you are expecting but this is aggregated data table. It doesn't provide idea about your data model is without your sharing your app. That is fine but in order to replicate and solve the issue it will be nice to have granular information that someone can take put it in QV and come up with formula to see where your calculation may be going wrong.

I was looking for information that Sunny usually shares on how to upload sample files. I should have bookmarked those link.

I'll include here a question that one of the community member has posted but because granular data was available to folks who were trying to help were eventually able to help.

Problem summing an average in pivot table

BR,

Vijay

qlikmpate0
Creator II
Creator II
Author

Please  find attached my app.

Thank @Vijay Vira, for Sunny Talwars link very helpful.

regards

Mina

sunny_talwar

You were using OrderQty for your Total Units... Try this

Sum([OrderQty])/Sum(TOTAL [OrderQty])


Capture.PNG