13 Replies Latest reply: Jun 7, 2012 9:22 AM by Nicole Smith

# Expressions with different dimensions in same chart

Hello everbody,

I wanted to know if it is possible in a line chart to have two expressions with different dimensions ?

Common dimensions : Period

1st expression : average of marks by period and by country

2nd expression : average of marks by period for all countries

Thank you

• ###### Expressions with different dimensions in same chart

Hi!

Well, you can achieve that particular effect by making having Period as dimension and then add an expression for each country and an expression for all the countries.

Example:

Expression 1

avg( {<Country{"USA"}>} Marks)

Expression 2

avg( {<Country{"UK"}>} Marks)

Expression 2

avg( {<Country{"*"}>} Marks)

This will show a line for each country and an average for all the countries.

Hope it help!

/Regards

• ###### Expressions with different dimensions in same chart

The problem is that I got numerous lines...

• ###### Re: Expressions with different dimensions in same chart

You can try the following:

Chart dimension: Period

1st expression: Avg(Marks)

2nd expression: avg(aggr(avg(Marks),Period, Country))

/Masha

• ###### Expressions with different dimensions in same chart

I got something very strange :

• ###### Expressions with different dimensions in same chart

avg(aggr(avg(Marks),Period, Country))

• ###### Expressions with different dimensions in same chart

I tried but it still not working. I don't have my average by country but a global line...

• ###### Expressions with different dimensions in same chart

Do you need one line for each country and one line showing global average?

In this case you should have 2 dimensions: Period and Country, and your expressions should be like that:

Global average: avg({<Country>} Mark)

Average by country: avg(Mark)

• ###### Expressions with different dimensions in same chart

It overlaps lines.

• ###### Re: Expressions with different dimensions in same chart

You can overlay two charts (with the top one transparent) to get what you're looking for (see attached).

• ###### Expressions with different dimensions in same chart

pierre_35 wrote:

It overlaps lines.

Did you have Country as chart dimension?

• ###### Expressions with different dimensions in same chart

Yes I tried with and without counrty as a dimension.

I want to have something like that :

In black, my global international average and in green and orange, average for each of my countries. The goal is to compare average of each country with the global average.

• ###### Re: Expressions with different dimensions in same chart

Overlaying the charts (like I mentioned above) is the only way for you to accomplish this.  This is because with the QlikView line chart, you can have one dimension and multiple expressions or two dimensions and one expression, but you cannot have two dimensions and more than one expression.

• ###### Expressions with different dimensions in same chart

Hi,

Could you add an example where your solution is working? I would appreciate it alot since it would be neat to reduce the hardcoding

/regards