8 Replies Latest reply: Nov 28, 2016 4:38 AM by Manish Kachhia

# Dimensions and Pie Chart

Hi everyone!

I am very new to qlik. Problem description:

So i have a data set with fields: shop names and sales from those shops and sales per category of a product in every shop. I want to create a pie chart with only two sections: Product Category A and Product Category B, which would sum the sales for each of these categories from all the selected shops in the filter. So no matter how many shops i select the pie chart is always divided only in two sections.

Edil

• ###### Re: Dimensions and Pie Chart

But what is your question? What output you want?

Use Shop as Dimension

and below expression

SUM({<Category = {'A','B'}>}Sales)

Change field names accordingly

• ###### Re: Dimensions and Pie Chart

When i use shop as a dimension, the pie chart is divided into as many sections as the number of shops i have. Instead I need the pie chart to be divided into two sections only. one section should show the sum of all the sales in all shops for Category A, the other section should show the sum of sales in all shops for Category B.

The question is, i guess, how do i create a dimension that contains the two categories, and a measurement for those categories?

Thanks

• ###### Re: Dimensions and Pie Chart

Use Category as dimension

SUM({<Category = {'A','B'}>}Sales) as expression

• ###### Re: Dimensions and Pie Chart

but i do not have a field that contains the categories. So i have Table 1, with sales on fruits for example, where i have apples, oranges etc. Then i have table 2 with sales on vegetables: carrots, tomatoes etc.

Now category A - apples

category B - carrots.

now i need a pie chart, to see what amount of income is delivered from carrots and how much i got from apples.

• ###### Re: Dimensions and Pie Chart

Dimension

Fruit

Expression

SUM({<Fruit = {'apples','carrots'}>}Sales)

Make sure that apples <> Apples and Carrots <> carrots....

Sales <> sales.. and Fruit <> fruit..

In short it is case sensitive..

• ###### Re: Dimensions and Pie Chart

okay, I think we are going somewhere.

the question that rises from here is:

How do i create a new dimension called "Fruit"? because in my table 1 it looks like:

Shop Name     Total Sales     Apple Sales     Orange Sales

Shop 1            100               60                    40

Shop 2             500               300                  200

And my table 2 looks something similar but for vegetables. So i do not have a field "Category" that would list the categories that i have which i could include.

• ###### Re: Dimensions and Pie Chart

I think better you provide sample data. Otherwise this is never ending discussion and wasting both of our time.

• ###### Re: Dimensions and Pie Chart

see the attach,if that is what you want.