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

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

Help plotting bar chart when an item is appears in two bars

Hi I'm new to QlickView and was looking for some help.

I have two columns of data, black_or_white and cat_or_dog.

Header 1Header 2Header 3
Animal_IDblack_or_whitecat_or_dog
Animal_1blackdog
Animal_2whitedog
Animal_3blackcat

On the same bar chart id like to plot a bar for the amount of dogs, a bar for the amount of black dogs, a bar for the amount of cats, and a bar for the amount of black cats.

I have managed to plot the amount of cats v dogs by having animals at the dimension and count(animals) as the expression. I have also managed to plot amount of white dogs, amount of black dogs, amount of white cats, amount of black cats using:

if(cat_or_dog = cat, if(black_or_white = white, 'white cat', 'black cat'), if(black_or_white = white, 'white dog', 'black dog') as the dimension.

But neither of these things is what i want. i want a bar for amount of dogs, and a bar for amount of black dogs....

Thanks very much

1 Solution

Accepted Solutions
MK_QSL
MVP
MVP

11 Replies
MK_QSL
MVP
MVP

Very confusing... I think you have to use Total Qualifier (may be)...!

Better if you can provide the result you are looking for based on sample table given.

Not applicable
Author

Hi thanks a lot for the reply. for the above example id like dogs = 2, black dogs = 1, cats = 1, black cats = 1.

catsDogs.jpg

MK_QSL
MVP
MVP

Like this?

kavita25
Partner - Specialist
Partner - Specialist

Check the qvw.

Not applicable
Author

Yes! that will do. thanks very much for your help

Not applicable
Author

Hey Manish thanks for your help.I'm nearly there.

Can you explain to me whats going on with the:

COUNT({<something = {'something'}>}DISTINCT [ID]) notation.

basically I simplified my data to try and explain it. What i want is instead of checking if a dog is black i want to check if the field is null. but i cant work out how to get the IsNull(field) to work in the expression you gave me.

Thanks a lot

MK_QSL
MVP
MVP

COUNT({<something = {'something'}>}DISTINCT [ID])


COUNT(DISTINCT ID) will count all Distinct ID


{<something = {'something'}>} This is set analysis which will work as a filter.

so

{<Month = {'March'}>} will give you result where month = March...

Say... SUM(If(Month = 'March',Sales)) = SUM({<Month = {'March'}>}Sales)


For Null

COUNT({<cat_or_dog = {'dog'}, black_or_white = {'=Len(trim(black_or_white))=0'}>}DISTINCT Animal_ID)


MK_QSL
MVP
MVP

Or you can use below

COUNT({<cat_or_dog = {'dog'}>}DISTINCT IF(IsNull(black_or_white),Animal_ID))

Not applicable
Author

Thanks for the explanation makes sense now. can get the

COUNT({<cat_or_dog = {'dog'}>}DISTINCT IF(IsNull(black_or_white),Animal_ID))

to work though. Ive swapped my variable names in, only difference i can see is that my field name is [black or white].

Also how would i check for not null?

Thanks