Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
nesonica
Contributor III
Contributor III

Divide value by the total of the column and compare

Hi guys,

 

I have a column field named "category"

in this "category" i have the values: "good", "medium", "bad".

 

1)

I want to see how high the share of the "category" is per each dimension "customer" in percent ("good" 30%, "medium" 60%, "bad" 10%)

 

2) 

Then I want to compare the share of a customer ("good" 30%) compared to the average customer ("good" 70%) and give the text information "the customer x is y % below average in the category z)

 

I hope I did not express it too complicatedly. Thanks in advance and sorry for the bad wording. 🙂

Labels (5)
13 Replies
dplr-rn
Partner - Master III
Partner - Master III

Use

Sum(Sales)/Sum(Total <Category> Sales)

out below

CustomerCategorySum(Sales)Sum(Sales)/Sum(Total <Category> Sales)
PeterA10025.00%
LarryA30075.00%
JohnA00.00%
PeterB400100.00%
LarryB00.00%
JohnB00.00%
PeterC50020.00%
LarryC90036.00%
JohnC110044.00%
hopkinsc
Partner - Specialist III
Partner - Specialist III

Hi, What about the attached. 

nesonica
Contributor III
Contributor III
Author

I would love to check it out, but unfortunately I have no rights to upload qvw in our QlikView . Could you please share the formulas with me? Thank you 🙂
hopkinsc
Partner - Specialist III
Partner - Specialist III

Hi,

[Customer Share]

sum(Sales)/Sum( total <Category> Sales)

Average

avg(total <Category>aggr(sum( {<Sales-={0}>}Sales)/Sum( total <Category> {<Sales-={0}>}Sales),Sales,Category))

Difference

[Customer Share]
-
Average

Advice

=if(Difference<=0,
'Category '&Category &' is '&num(Difference,'#,##0.00%') & ' under average',
'Category '&Category &' is '&num(Difference,'#,##0.00%') & ' above average'
)

 

Note that the 'Difference' expression use the previous expression names of  [Customer Share]  and [Average] and the 'Advice' expression uses the [Difference] expression name.

See attached image of result