# QlikView App Development

Discussion Board for collaboration related to QlikView App Development.

Announcements
Modernize Your QlikView Deployment webinar, Nov. 3rd. REGISTER
cancel
Showing results for
Did you mean:
Highlighted
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 Trade No of Customers Total Units Total Sales % Units % Sales AGENCY 19 79,728 247,643 1.49% 2.07% DECORATOR 70 2,064,481 4,535,474 12.38% 16.86% DISTRIBUTOR 98 38,485,801 108,168,466 67.51% 69.18% MANUFACTURER 3 52,531 138,689 .11% .11% RETAIL 9 412,017 356,427 .38% .51% WHOLESALE 45 2,433,573 4,398,952 6.76% 8.17% - 33 328,100 675,878 11.36% 3.09% 277 43,856,231 118,521,528 100.00% 100.00%

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

regards

M

1 Solution

Accepted Solutions
Highlighted
MVP

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

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

22 Replies
Highlighted
MVP

Sum([Qty])/Sum(TOTAL [Qty])

Sum([Sales \$]/Sum(TOTAL [Sales \$])

Highlighted
Creator II

Thanks Sunny this gives an incorrect % value for both units and sales

Highlighted
MVP

Would you be able to share a sample?

Highlighted
MVP

Script doesn't help... what do you get when you use this?

Sum([Qty])/Sum(TOTAL [Qty])

Highlighted
Creator II
 Class of Trade No of Customers Total Units Total Sales % Units % Sales AGENCY 19 79,728 247,643 .26% .30% DECORATOR 70 2,064,481 4,535,474 6.14% 5.10% DISTRIBUTOR 98 38,485,801 108,168,466 85.92% 89.82% MANUFACTURER 3 52,531 138,689 .03% .04% RETAIL 9 412,017 356,427 1.31% .41% WHOLESALE 45 2,433,573 4,398,952 5.29% 3.53% - 33 328,100 675,878 1.05% .79% 277 43,856,231 118,521,528 100.00% 100.00%
Highlighted
MVP

Can't really say what might be wrong here without looking at your dimensions, expressions and chart settings... may be someone else can help...

Best,

Sunny

Highlighted
Master

Can you share the app ?

Highlighted
Creator II

I only have one dimension and that is the trade all expression attached

Highlighted
Creator II

Sorry no because too much company info