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

Announcements
Qlik Connect 2026! Turn data into bold moves, April 13 -15: Learn More!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

How to count "Yes" from the cells in different column?

Hello guys I need a little help.

I have this example table:

UserFacebookLinkedinTwitterInstagram

A

YesYesNoNo
BYesYesYesYes
CNoYesNoYes
DYesNoYesNo

How can I count "Yes" from this four different columns?

14 Replies
sunny_talwar

You can either use CrossTable Load to transpose your data (The Crosstable Load)

Table:

CrossTable(Platform, Response)

LOAD User,

          Facebook,

          Linkedin,

          Twitter,

          Instagram

FROM ....;

and then you can do like this:

Count({<Response = {'Yes'}>} Response)

If you don't wish to transpose your data, you can do like this:

RangeSum(

Count({<Facebook = {'Yes'}>} Facebook),

Count({<Linkedin = {'Yes'}>} Linkedin),

Count({<Twitter = {'Yes'}>} Twitter),

Count({<Instagram = {'Yes'}>} Instagram))

maxgro
MVP
MVP

in a str table with user as dimension you can try the expression

SubStringCount(Facebook & Instagram & Linkedin & Twitter, 'Yes')

johnw
Champion III
Champion III

Note that the transposed data can be in addition to the current data. Each model of the data supports different sorts of requirements. But often a single model can suffice in a given application.

Not applicable
Author

Thanks buddy. It works.

johnw
Champion III
Champion III

Nice. I'm guessing User won't be the dimension, but of course you can wrap it in a sum(aggr(...,User)).

sum(aggr(SubStringCount(Facebook & Instagram & Linkedin & Twitter, 'Yes'),User))

And because it amuses me, this silly expression works too, but I'm not suggesting it - just amused by it.

-sum(pick(valueloop(1,4),Facebook='Yes',Linkedin='Yes',Twitter='Yes',Instagram='Yes'))

But I'd probably stick with Sunny's expression if performance matters and you can't change the data model. Else I'd do the crosstable load as he suggested.

Edit: Or this, but again, not a suggestion, just amusing myself.

-sum(aggr(rangesum(Facebook='Yes',Linkedin='Yes',Twitter='Yes',Instagram='Yes'),User))

MarcoWedel

Hi,

another solution, in case the field names of interest may vary but are located in one table, might be:

QlikCommunity_Thread_237475_Pic1.JPG

QlikCommunity_Thread_237475_Pic2.JPG

-RangeSum($(=Concat({$<$Table={'example table'}, $Field-={'User'}>} $Field,'=''Yes'',')&'=''Yes'''))

I would prefer Sunny's CrossTable solution though.

hope this helps

regards

Marco

Not applicable
Author

Ok, another question.

I want to show a Bar Chart just with sum of "Yes" and "No" for all that collumns (Facebook, Linkedin...).

How can I do this? What field do I need to enter on Dimensions in the RangeSum use case?

Sorry for the question, I'm learning alone about this tool .

Thanks.

Not applicable
Author

=Count({<Facebook={YES'}>}Facebook)+Count({<Linkedin={YES'}>}Linkedin)+Count({<Twitter={YES'}>}Twitter)+Count({<Instagram={YES'}>}Instagram)

Not applicable
Author

This count I insert o Measures. But which field I need to put on Dimensions?