Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Issue with Line Chart


Hi,

I have a requirement where need to create line chart with 2 dimensions and 2 metrics.

Where my first dimension need to be on x-axis ,and my first metric line need to be split based on 2nd dimension and 2nd metric need to be display at 1st dimension level.

Means one metric need to be show the lines in detail at 2nd dimension level and other metric need to be display at aggregate level(1st dimension level) in the same chart.

Ex;

MonthCountrySalesOrders
Jan-15India200400
Feb-15USA300500
Mar-15China500600

With  the above example in line Chart the Sales line need to be display at Country level( for each country one line) and Orders need to be display at Month level(one line) .

Is it possible in Qlikview to show lines of  one metric at detail level and other metric at aggregate level in charts.

Thanks,

Shekar.

1 Solution

Accepted Solutions
Not applicable
Author

Hi,

I got the clue.

Where we can use expression for each country by using  Only & Set analysis functions. So that we can get one metric at detail level and other metric at aggregate level.

USA Sales Exp:Only({<Country={'USA'}>} Sales

India Sales Exp:Only({<Country={'India'}>} Sales

China Sales Exp:Only({<Country={'China'}>} Sales)

Total Orders  Exp:Sum(Orders)

Thanks,

Shekar.

View solution in original post

5 Replies
petter
Partner - Champion III
Partner - Champion III

Could you add some more to the example data and possible use Excel to show us the chart how it should look like?

Not applicable
Author

Hi,

Here is more sample data:

MonthCountrySalesOrders
Jan-15USA300600
Jan-15China600800
Jan-15India200400
Jan-15Total11001800
Feb-15USA300400
Feb-15China200300
Feb-15India300500
Feb-15Total8001200
Mar-15USA500600
Mar-15China400500
Mar-15India300400
15-MarTotal12001500

On X-axis Month and Y- axis Sales and Orders need to be get display. Ex: for Jan-15 Sales as to display in 3 lines (300,600,200)(one for each country), Orders need to be display in one line as 1800(total).

Hope you understood my requirement.

Thanks,

Shekar.

petter
Partner - Champion III
Partner - Champion III

yes now it is much easier to understand - thank you

Not applicable
Author

Hi,

I got the clue.

Where we can use expression for each country by using  Only & Set analysis functions. So that we can get one metric at detail level and other metric at aggregate level.

USA Sales Exp:Only({<Country={'USA'}>} Sales

India Sales Exp:Only({<Country={'India'}>} Sales

China Sales Exp:Only({<Country={'China'}>} Sales)

Total Orders  Exp:Sum(Orders)

Thanks,

Shekar.

petter
Partner - Champion III
Partner - Champion III

Exactly - You don't have to have all dimensions in the Dimension tab you can also

pick out your values with Set Expressions by referring to dimensions in the expression

as you noted. However I wouldn't go for the Only() aggregate function unless you always

know that you will get one value per dimension on the x-axis. Sum is still good as aggregate

here.

So:

    Sum( { < Country={'China'} > Sales )

    Sum( { < Country={'India'} > Sales )

    Sum( { < Country={'USA'} > Sales )

    Sum( { < Country={'TOTAL'} > Orders )

But actually you should drop all the rows with TOTAL in your data model and rather have:

    Sum( { < Country={'China'} > Sales )

    Sum( { < Country={'India'} > Sales )

    Sum( { < Country={'USA'} > Sales )

    Sum( Orders )

    Sum ( Sales )

Which is much safer and with less redundancy and little room for mistakes...

2015-05-01 #7.PNG