Skip to main content
Announcements
Introducing a new Enhanced File Management feature in Qlik Cloud! GET THE DETAILS!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Counting colors

Hi

I have a graph like this:

2013-09-17 08-10-10.jpg

How can i count how many bars are Blue, Red and Green?

My expression is like this for Background color 

if (ABC='A',LIGHTRED() ,if (ABC='B',LIGHTBLUE(),if (ABC='C',LIGHTGREEN())))

Best regards

/Mats

Message was edited by: matshawk

10 Replies
tresesco
MVP
MVP

That depends on how your expression decides on color. Please share a sample app.

AbhijitBansode
Specialist
Specialist

It all depends on your expression.

But if you have limited number of values in your dimension then something like below would help:

count({<ABC= {'A'}>}ABC)  -- # of LightRed bars

count({<ABC= {'B'}>}ABC)  -- # of LightBlue bars

tresesco
MVP
MVP

Again, dimension members are needed. Anyway, try like this: take a straight table with similar dimension member and expression as : If( ABC='A', 'RED :'&Count(ABC), IF(ABC='B' , 'Blue :'&Count(ABC), If(ABC='C', 'Green :'&Count(ABC))).

Though i am not sure it would work. Best way could have been- sharing sample app. If you are worried about the data, you can always scramble it upload. See how to prepare for upload .

Not applicable
Author

Hi

I have come some way by doing like this:

My dimension is Machine_Beläggning of which are divided in some 'A', some 'B' and some 'C' machines

If i have an expression like this: if (ABC='A',1, count({<ABC= {'A'}>}ABC) ), i get one bar for each machine that is an 'A' machine. So far so good... The thing is that i don't want bars, just a number that are the sum of the 'A' machines, in this case 7.

Best regards

/Mats

er_mohit
Master II
Master II

if you want to count it then take three text object with equal sign write your condition

like this

=count(if (ABC='A',ABC))  //for 1st one text object

count(if (ABC='B',ABC)) //for LIGHTBLUE() for 2nd text obj

count(if (ABC='C',ABC)) // for LIGHTGREEN() (3rd text obj)


hope it helps

tresesco
MVP
MVP

May be like this? take ABC as a dimension in a straight table and use expression: Count(ABC)

stigchel
Partner - Master
Partner - Master

Without a dimension you would need an aggagrate:

Aggr(Count(if(ABC='A',ABC)),Machine_Beläggning)

Not applicable
Author

Hi

I only want to count the ’A’s, ’B’s or ‘C’s that have values on them.

Does this make sense?

7 ‘A’s, 3 ‘B’s and 6 ‘C’s

/Mats

tresesco
MVP
MVP

Then try the expression something like:

Count(If(not isnull(YourValueField) and YourValueField<>0, ABC)