Skip to main content
Announcements
Live today at 11 AM ET. Get your questions about Qlik Connect answered, or just listen in. SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Simple bar chart of 2 variables

Hey,

I'm totally knew to Qlikview and I want to make a barchart of ProductID and UnitsInStock.

I have a table, called products that has a column ProductID and a column UnitsInStock, so I just want those 2 on a bar chart.

But how do I do this? Cause if I choose ProductID as first dimension and as expression UnitsInStock, it doesn't work.

Do I always have to use count, sum or something else in the expression?

Thanks in advance!

13 Replies
Not applicable
Author

Hi,

You don't have to use count or sum. Just take ProductID as Dimension and UnitsInStock as Expression like this ( =UnitsInStock ) in Bar chart. It will automatically show you the no. of units in stock per product id.

Apurva

richard_chilvers
Specialist
Specialist

I think that approach is fine as long as there is just one record for each ProductID. However, if ProductID is duplicated in anyway (for example an additional field per record shows StockLocation) then this will show no value/Null value. Its best to use Sum which works in both cases.

Not applicable
Author

I think your values are getting repeated in the database,

so if you simply apply units in stock then it won't work.

So there must be a date associated with each value,

so that you can find units in stock of product id accoding to last entry in the date.

eg:

product id         units in stock                         date

1                        10                                       12/04/2011

1                         8                                        12/05/2011

then you can find out units in stock of product id, which is 8 not 10 according to last date entry.

So try to associate date with each data entry then apply the below expression in your bar chart:

=aggr(aggr(units in stock,product id),aggr(product id,max(date)))

I think it will help.

regards

vijit

Not applicable
Author

That doesn't work, i don't understand why but it gives an error.

Not applicable
Author

We don't work with dates, it's just the stock at this moment that's in the table

richard_chilvers
Specialist
Specialist

Are you able to send the application for us to look at ?

Or ... what error are you seeing ?

Not applicable
Author

It says 'error in the expression' when i type (=UnitsInStock) in the expression field

But for every productID there's only one value for UnitsInStock and every productID is mentioned only once in our table.

Not applicable
Author

is there any primary key according to which you can differentiate your data other than product id , as it is getting repeated.

Not applicable
Author

Every productID is only mentioned once in our table Products, so that's the key.

Productname can also be the key, but that's not a good idea, i think.

But in other tables in our database productID is used to, can that be the problem?