Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello,
I am kind of new to Qlikview, so forgive me if this question is something I should know.
I am trying to create a Bar chart which counts the different values in a column, but I only want to count the values in this column if another column in the same row has a spesific value.
How can I achieve this?
Thanks,
Robert
hi, you are moving correctly.. don't put the dollar sign.. are using some variables.. keep things simple.. count(if(referenceColumn='TRUE',Column_To_Counted))
Yes you can use set analysis
as
count({$<Coulunn2=''>}column1)
Try it or vie set analysis document in the community document available as pdf.
Where do I put this expression? I tried to put it in definition, but then I get no value in my bar chart.
Hi Robert,
You have to put the expression in your expression's page..and not on edit dimension.. if you are not comfortable using set analysis..then please make use of the normal if condition.. like--sum(if(country='MEXICO',sales))... try out this sort of expression and you will land in getting the correct values.. however this could make your bar chart a bit heavy..means it will take a bit time to open up
Ok, so I have done the following..
Created a new expression on the bar chart object. with the following expression:
count ({$<referencing column='the value of this column that has to be true for the value to be counted'>}column that is counted)
is this correct?
hi, you are moving correctly.. don't put the dollar sign.. are using some variables.. keep things simple.. count(if(referenceColumn='TRUE',Column_To_Counted))
hi, I have constructed the expression as you suggested, but I'm using a 'Word' instead of 'TRUE'. Problem is when I do this I get no value.
However, I found a "hack" way to do it via bookmarks. First i created a selection for the value in the reference column, then bookmarked it and then using the expression Count ({BOOKMARK} COLUMN_TO_BE_COUNTED) I got the result I wanted, but it seems kind of messy :S
What could I be doing wrong with the expression you specified?
Hi Robert, ok if you got the result using BOOKMARK.. that way is also correct.. but why to make things complicated.. you need not use 'TRUE' as that was only an example.. instead use the value you need to validate against that particular field.. use the expression I suggested and put the value you require to validate in place of TRUE.. when you achieve this then gradually start using set analysis further in your expression.. I hope you must have understood my point.. Regards