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

Announcements
Join us to spark ideas for how to put the latest capabilities into action. Register here!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Count if / count the number of occurences

Hi, I'm really new to Qlikview (only been using it a couple of days so far) and wondered if anyone would be able to help me with a formula I'm stuck on.

I'm trying to count the number of times the letter "S" appears in a data set, and show this as a number that I can then perform other calculations from.

The best I've got so far is:

                              =count(if([UNIT.M_SOLD_VIA]='S',#,###,###'))

This shows me the answer, but it is formatted as text, not as a number.

Cheers, Simon

1 Solution

Accepted Solutions
Not applicable
Author

Hi Eduardo, *I got an error when I pasted your expression in, I removed {$ to give me:

      =num(count({<UNIT.M_SOLD_VIA={'S'}>} UNIT.M_SOLD_VIA), '#,###,###')

This worked great, big thanks to you, would never have got there on my own

View solution in original post

3 Replies
eduardo_sommer
Partner - Specialist
Partner - Specialist

Try this expression

     =num(count({${<UNIT.M_SOLD_VIA={'S'}>} UNIT.M_SOLD_VIA), '#,###,###')

This will count every occurence of the field UNIT.M_SOLD_VIA where UNIT.M_SOLD_VIA has a value of 'S'

Eduardo

Clever_Anjos
Employee
Employee

count(if([UNIT.M_SOLD_VIA]='S',UNIT.M_SOLD_VIA))

or better

count({<[UNIT.M_SOLD_VIA]={'S'}>} UNIT.M_SOLD_VIA )


you can format your number under "Numbers" tab

Not applicable
Author

Hi Eduardo, *I got an error when I pasted your expression in, I removed {$ to give me:

      =num(count({<UNIT.M_SOLD_VIA={'S'}>} UNIT.M_SOLD_VIA), '#,###,###')

This worked great, big thanks to you, would never have got there on my own