22 Replies Latest reply: Apr 19, 2018 11:52 AM by Sunny Talwar

# Share of Total

Hi all,

I have a question. I have following table

 Customer Product Value A 1 10 A 2 5 A 3 10 B 1 10 B 2 0 B 3 5 C 1 0 C 2 0 C 3 10

Goal is to find out the share of a product in a Portfolio of a customer. If I select Product 1, I want to know the share of product 1 to all products of each customer. In this case it would give me following results:

Dimension Selected: Product 1:

 Customer Share A 40% B 67% C 0%

How should be the expression in set Analysis?

With my Expression I get only the share of a selected product to all products for each customer:

sum({\$<criteria_1={'yes'}>}Value)/sum({\$<criteria_1={'yes'}>}Total <Customer> Value)

In this Case I would become this:

A 50%

B 50%

C 0%

Thanks

• ###### Re: Share of Total

May be this

Sum({\$<criteria_1={'yes'}>}Value)/sum({\$<criteria_1={'yes'}, Product>}Total <Customer> Value)

• ###### Re: Share of Total

perfect, thanks!

Will try in the next days and let you know if it works

• ###### Re: Share of Total

Sounds good

• ###### Re: Share of Total

Short Update:

The Expression in a table seems to work:

 Product Category Product Subcategory Product Customer Value Share X A Q 1 20 57% X A W 1 10 29% Y B E 1 5 14% X A Q 2 5 25% X A W 2 5 25% Y B E 2 10 50%

Now I have an additional Value (Performance by customer). In the table it is correct (Same Performance for each product by customer-->I only have the Performance by customer and not by product).

Now I Need a Point Diagramm (Dimension Product, X-Axis "Share" and Y-Axis "Performance by customer"). If I select a random customer the Point Plot is correct. But If i want to Show the Plot for all customer (no selection), the X-Axis ("share") is wrong. How is it possible?

• ###### Re: Share of Total

Would you be able to share a sample to show what you have?

• ###### Re: Share of Total

Example should be the table above. Goal is a Point Plot with following expressions:

Dimension: Product

X-Axis: Share: Sum({\$<criteria_1={'yes'}>}Value)/sum({\$<criteria_1={'yes'}, Product>}Total <Customer> Value)

Y-Axis: Performance: Median({\$<Criteria_2={'yes'}>}Performance/100

Now If I select Customer 1, the Point Plot Shows the Performance of Customer 1 and the Share of all Products. E.g. Performance is 1.5% and customer 1 has 3 products, then the plot Shows all 3 products by share (X-Axis) and each product has the same Performance of 1.5% (y-Axis).

Now I de-select the customer and have again all Positions of all customers. There the share is wrong calculated.

Wrong means that the share is not calculated by each customer, but it calculates she share of each product to all products from all customer

• ###### Re: Share of Total

I am not sure I am able to understand still... I am not even entirely sure if I will be able to recreate the chart with your issue and hence was asking you to share an app (may be with the above data) and recreate the chart and issue for me so that I can see and play around with it.

• ###### Re: Share of Total

how can i share an example or screenshot?

If it doesnt work: On the Point Chart it Shows me the share of Product over all customer and not the share of product in the Portfolio of a customer

• ###### Re: Share of Total

Unfortunately Up&Download doen't work where i have my Qlik Sense. Maybe another Explanation helps to understand the Problem:

Given is following table:

 Customer Container Product Value Mad 1 AB 5 Mad 1 AC 10 Mad 1 AD 20 Mad 1 AE 55 Mad 2 AF 10 Mad 2 AG 5 Max 3 AB 10 Max 3 AC 10 Max 3 AG 20 Max 3 AF 50

I have 2 customer. Each customer can have one or more Container, but each Container can only owned by one customer. In the case above customer Mad has 2 Containers (1 and 2) and Max has one (3).

In each Container there are products. E.g. Container 1 has 4 different products.

But the same products could be in different Containers. E.g. Product AC is in Container 3 (Max) and Container 1(Mad), but with different values.

Now I want to know the share of value for each product in a Container. Means: Product AB for Mad has a share of 5.56% (5/sum(5+10+20+55)). The result should be the following:

 Customer Container Product Value Share in the Container Mad 1 AB 5 5.56% Mad 1 AC 10 11.11% Mad 1 AD 20 22.22% Mad 1 AE 55 61.11% Mad 2 AF 10 66.67% Mad 2 AG 5 33.33% Max 3 AB 10 25.00% Max 3 AC 10 25.00% Max 3 AG 20 50.00% Max 4 AF 50 100.00%

Now what Kind of Expression can calculate the share of a product within a Container of a customer.

IF I take the Expression:

sum({\$<criteria_1={'yes'}>}value)

/sum({\$<criteria_1={'yes'}>}Product>} Total<Customer> Value)

I get the total Value of all Container, but I only Need the share of a product in his Container.

Does it help to understand?

• ###### Re: Share of Total

Got it, try this

Sum({\$<criteria_1={'yes'}>}value)/Sum({\$<criteria_1={'yes'}>}Product>} TOTAL <Customer, Container> Value)

• ###### Re: Share of Total

Ok, it works whenI have the table with the Customer Name as 2nd Dimension

But if I have only the Products (as only Dimension) in the table as:

then it doesn't work. Any idea how this would be possible?

 Product Value Share in the Container AB 5 5.56% AC 10 11.11% AD 20 22.22% AE 55 61.11% AF 10 66.67% AG 5 33.33% AB 10 25.00% AC 10 25.00% AG 20 50.00% AF 50 100.00%
• ###### Re: Share of Total

Sum({\$<criteria_1 = {'yes'}>} Value)/Sum({\$<criteria_1 = {'yes'}, Product>} TOTAL <Customer, Container> Value)

• ###### Re: Share of Total

Try this in that case

Aggr(Sum({\$<criteria_1 = {'yes'}>} Value)/Sum({\$<criteria_1 = {'yes'}, Product>} TOTAL <Customer, Container> Value), Customer, Container, Product)

• ###### Re: Share of Total

Aggr(Sum({\$<criteria_1 = {'yes'}>} Value)/Sum({\$<criteria_1 = {'yes'}, Product>} TOTAL <Customer, Container> Value), Customer, Container, Product)

With this Expression each product has a share of 0%

• ###### Re: Share of Total

sorry, I used Aggr(Sum({\$<criteria_1 = {'yes'}>} Product instead of Aggr(Sum({\$<criteria_1 = {'yes'}>} Value

Now it works;)

Many thanks

• ###### Re: Share of Total

Sorry, other question: do you know why the num function doesnt work in the expression

Aggr(Sum({\$<criteria_1 = {'yes'}>} Value)/Sum({\$<criteria_1 = {'yes'}, Product>} TOTAL <Customer, Container> Value), Customer, Container, Product)

i tried: num(Aggr(Sum({\$<criteria_1 = {'yes'}>} Value)/Sum({\$<criteria_1 = {'yes'}, Product>} TOTAL <Customer, Container> Value), Customer, Container, Product),'#.##%')

but it doesn't works..

• ###### Re: Share of Total

Are you using expression default or not? If not, then please do

• ###### Re: Share of Total

the color is for a chart. so color by key figure(with the different red color gradually). is this possible?

• ###### Re: Share of Total

Color? Where did the color came from? Are we talking about different issues or are we still working on the same problem?

• ###### Re: Share of Total

its another problem,but with the same expression. Shall i open a new thread?

• ###### Re: Share of Total

Yes, I would think so... also, provide more details as this might not be enough to know what you are trying to do.