Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us in NYC Sept 4th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Creating a bar chart with 2 dimensions and 2 expressions


Hello everyone,

I am new to QlikView and i am trying to create a bar chart with two dimensions from two different tables, and both dimensions has the same values. I also create two expressions to count the total of each one.

The chart is presenting the correct values, however it displays the same value in each line, as you can see in the print screen below:

tempo.png

When i create the chart using only one dimension and one expression, the chart is displayed correctly, as shown in the print screen below:

tempoone.png

What i have to do to show both dimensions in one single line as presented in the chart above??

Thanks in advance,

Rodrigo

30 Replies
MK_QSL
MVP
MVP

Provide sample QVW !

Not applicable
Author

if both dimesnions have the same value, can you not make that field a key and then you would only have 1 diemnsion and expression but get data from both tables.

Anotehr thought - can your single expression be (Expression 1 Expression 2) ?  If both dimesnisons have the same value, can you pick one of them and have your expression be the total of the 2 (not sure if you are doing sum, count but it should not mater)

Not applicable
Author

Hi Adam,

Thanks for your tips!!

I tryed to make that field a key, but is not possible to execute my script when i use the same name for both dimensions. I received an error message saying that is not possible to execute the script.

I need to display both dimenisions separately, the user should see both information in 2 distinct colors. When i said the dimension have the same value, i meant that both dimension displays values of "less tanh 1 year", "more than 10 years", "1 to 2 years", etc.

Thanks,

Rodrigo

Not applicable
Author

I do not understand why you cannot make them a key - QlikView allows that and that is how tables get linked together - 1 and only 1 field in 2 tables with the same name - if you have multiple fields of the same name pointing from one table to another, you will get a synthetic key (which is not good) but the script will run (I have run into the synthetic key a time or 2).

What about a single dimension (pick one) and have your 2 expressions, and have the bars set as stacked?

Not applicable
Author

Creating a single dimension and having 2 expressions displays the chart the way i need, but now the values in red color are wrong, all are with the same value, as shown below:

years.png

I am counting the total of the two dimensions in 2 expressions:

Count (expression1)

Count (expression2)

Only the first expression bring me the correct values.

Do you know why this happened?

Thanks,

Rodrigo

Not applicable
Author

what about crating the same new dimension when you load both tables - something like below

LOAD *,
If([ Days]>= 0 and [ Days] < 31,'0-30',
if ([ Days] > 31 and [ Days] < 46,'31-45',
if ([Days] > 45,'Over 45'))) as Age;

or possibly a calculated dimension with your 2 expressions represented as a stacked bar.

Har to determine what is best, if any of these suggestions without seeing the data model

Not applicable
Author

is the value of 79 in red) correct for any of the dimesnion values?

any chance you can provide a qvw with the data?

not being able to name the 2 dimesnions the same does not make sense

Colin-Albert
Partner - Champion
Partner - Champion

Try a trellis chart if you need 2 dimensions & 2 expressions.

Create bar chart with 2 dimensions & 2 expressions and tick the trellis option on the Dimensions tab.

The Year bucket, should be your second dimension.

Otherwise just use 1 dimension & 2 expressions.

Not applicable
Author

I am thinking the issue is because the expresssion 2 does not really go with the dimension

If you could send a qvw that would be a great help

do you want your bars grouped (like in the example above), stcked like some earlier ones, or don't care as long as the numbers are correct - stacked to me only makes sense the different colors/dimensions add to a meaningful total