Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
eduardo_dimperio
Specialist II
Specialist II

Count with Set Analysis

Hi everyone,

I need to count a field only with len(field) =11, but I think that we can't use an expression on the first part of a set analysis .

COUNT({$<len(CNPJ)={11}>}DISTINCT CPF_CNPJ)

Thank you

Labels (1)
1 Solution

Accepted Solutions
Vegar
MVP
MVP

Try

COUNT({$<CNPJ = {"=len(CNPJ)=11"}>}DISTINCT CPF_CNPJ)

View solution in original post

5 Replies
Vegar
MVP
MVP

Try

COUNT({$<CNPJ = {"=len(CNPJ)=11"}>}DISTINCT CPF_CNPJ)

Rohan
Specialist
Specialist

Hey,

Why don't you create a field in the back end that has the length of your field value & then use that in the Set Analysis Expression.

load

*,

len(Required Field) as length

from {your table};

Then in front end :

Count({$<length={11}>} distinct [required field])

Let me know if this works .

 

AlexPolorotov
Partner Ambassador
Partner Ambassador

Try to create a new calculated field in your data model: len(CNPJ) as field_len.   

And then in your set expressions you can use simple  set expression: 

 

COUNT({$<field_len={'11'}>}DISTINCT CPF_CNPJ)

 

eduardo_dimperio
Specialist II
Specialist II
Author

Hi Rohan, 

Indeed I could do, but I want to learn how to do this in Chart side.

eduardo_dimperio
Specialist II
Specialist II
Author

Perfect