Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
NimmiKal
Contributor
Contributor

Count Number of occurrences

Hi, Could you assist me with the formula to count number of occurrences of the values in a column?

For example, I have a customer_id column in a table which has values such as 1, 2, 1, 5, 4, 1, 4, 3 etc. Basically one customer id could appear multiple times in the customer_id column.

I need to do apply Background colors on the cells using expressions based on single or multiple occurrences of customer IDs in this column. For example I would like to represent respective cells for customer IDs 1 & 4 (that appears more than once) with Red color and cell with customer IDs 2, 3 & 5 (that appears only one time)  with blue color in the column

Any suggestions regarding an expression / formula is appreciated. 

Labels (1)
1 Reply
Taoufiq_Zarra

May be

in dimension and measure ->Background Color Expression

expression :

=if(aggr(count(customer_id),customer_id)>1,red(),Blue())

output:

Capture.PNG

attached an qvf example

Regards,
Taoufiq ZARRA

"Please LIKE posts and "Accept as Solution" if the provided solution is helpful "

(you can mark up to 3 "solutions") 😉