Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

Announcements
Uploads getting stuck in the virus scanner. We are investigating.
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
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
Highlighted
Partner
Partner

Try

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

Plees ekskuse my Swenglish and or Norweglish spelling misstakes

View solution in original post

5 Replies
Highlighted
Partner
Partner

Try

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

Plees ekskuse my Swenglish and or Norweglish spelling misstakes

View solution in original post

Highlighted
Creator
Creator

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 .

 

Highlighted
Partner
Partner

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)

 

Highlighted
Specialist II
Specialist II

Hi Rohan, 

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

Specialist II
Specialist II

Perfect