13 Replies Latest reply: Aug 29, 2017 12:45 AM by Aushik Makdoom

# How to create a box plot ?

Hi All

I want to plot the box plot chart by Brand vs sales.

I get only one items. on the chart.

For Brand Core i have 6 items.

How to make the chart display 6 items ?

Paul

• ###### Re: How to create a box plot ?

Hello Paul!

The Box Plot needs a minimum of one dimension and one measure. In your case you have Brand - a clear dimension and then 'Sales' - which is your measure.So Qlik Sense first aggregates the Sales by the 6 Brands and plots a single Box Plot for the six aggregated sales.

If you want to view a box for each brand then you will need to add another dimension (first dimension) which  depends on how you wish to aggregate your sales.Brand will be your second dimension

For example I included the 'Year ' field and what is does is it calculates the Sales by Year for each brand and the box plot is plotted for each brand according to its yearly sales values (you may see it by daily sales, monthly sales or at any another level)

If you wish to look at the box plot for the atomic sales values (ie at each record level ) by brand you will need to include the 'sales' as the first dimension followed by brand and then you will have to include sum(sales) in the measure. (Thus sales is added in both dimension and measure)

This will give you the box plot based on each sale value by brand. However this can consume large cpu resources if the data is huge.

• ###### Re: How to create a box plot ?

The above chart shows the box plot of Annual Sales by Brand.

• ###### Re: How to create a box plot ?

Hi Aushik

Appreciate very much you look into my question. I have follow your instruction , add sales into 2nd dimension , but the chart does not display same as you. it is possible you send me your QVF ?

• ###### Re: How to create a box plot ?

Hi Paul!

When I plotted the box plot at the atomic sales value level I also got the same result as you showed. This is because the sales column has many extreme values (positive and negative) and these possible outliers are limiting the range of the box plot.

I was able to get reasonable results when the sales was plotted by brand at the annual sales level (dim = year).

Please find attached the changed qvf. Please let me know in case of questions.

• ###### Re: How to create a box plot ?

Hi Aushik

Thank you very much , it work fine now.

May i know why must put =year at 1st dimension , instead of sales ?

Paul Yeo

• ###### Re: How to create a box plot ?

Hello Paul,

You can put the dimension as sales as well. Assuming you have 20 years of data and each year has 1000 values..so you have a  total of 20000 values.

If you use the 'sales' as a dimension then all the 20,000 values are plotted in the bar. If you use 'year' as dimension then the values are aggregated for the 20 years  and the 20 aggregated points are plotted in the bars.

Please let me know if you need more details.

• ###### Re: How to create a box plot ?

Hi Aushik

i use the QVF file you send me . Why when I click year =2016 , it does not able display the box chart ?

and why I need to select year 2016 and 2017 then it able plot the box chart ? The reasons is i want to compare the box plot chart for 2017 and 2016.

HOpe you can can share with me .

paul

• ###### Re: How to create a box plot ?

Hi Yeo!

Greetings!

The Box plot in Qlik Sense accepts only two dimensions and one measure. So in our earlier case I have already aggregated it the two dimension level (Year and Brand)

Year - Agggregation dimension

Brand - Plotting dimension

Sales - Measure

In case you want to look at the box plot at both the Year and Brand level then one option I can think of is to combine the Brand and Year into a single dimension (plotting dimension). You may have the values at basic transaction level (Aggregation dime = 'Sales') or you may have them aggregated at a different level.

I will try to come back with a changed qvf doc later if you need it.

Best Regards

Aushik

• ###### Re: How to create a box plot ?

Hi Aushik

Yes , I need the new QVF , hope you can share with me . So that I can compare the box plot by year.

Paul Yeo

DIrector

TDS Technology (S) P/L

Whatsapp +65 9326 1804

www.tdstech.com<http://www.tdstech.com>

• ###### Re: How to create a box plot ?

Hi Yeo,

Please find attached the modified file. I have created a sample data to build the report as the data model inthe app is very complicated.

Best Regards

Aushik

• ###### Re: How to create a box plot ?

Hi Aushik

Sorry my data structure is messy. But it work fine.

I just open the QVF file , I saw the dimension , you at a field = SampleDate , since I am the one who create this QVW , I don't remember I have create  this field name.

Paul Yeo

DIrector

TDS Technology (S) P/L

Whatsapp +65 9326 1804

www.tdstech.com<http://www.tdstech.com>

• ###### Re: How to create a box plot ?

Hi Yeo,

The 'SampleDate' field is a random field created by me for illustration. You cna replace this with the date field from which 'year' is calculated in your app.

BR

Aushik