Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
bhavvibudagam
Creator II

Count with keep char

Hi Experts,

Can any one please help me on this.

From the below Name field how to get the count of alphanumeric records(SONY1,JOHN235 -count with only caps letters)

and all CAPS letter records count(HONY,PHILIPS)

 

Name
SONY1
JOHN235
HONY
PHILIPS
abc
xysdz

Thanks in advance.

1 Solution

Accepted Solutions
kaushiknsolanki
Partner Ambassador/MVP

Try this

=Sum(Aggr(if(isnum(KeepChar(Name,'0123456789')) and IsText(Name),1,0),Name))

I am checking if it is num and text both, if yes then count.

Regards,

Kaushik Solanki

Please remember to hit the 'Like' button and for helpful answers and resolutions, click on the 'Accept As Solution' button. Cheers!

View solution in original post

6 Replies
tresesco
MVP

=Count( If(Upper(KeepChar(Name, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'))=Name, Name))

OR just,

=Count( If((KeepChar(Name, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ')=Name, Name))

OmarBenSalem

names:

load *, if(Name = UpperName, 1,0) as Flag;

load *, PurgeChar(Name,'abcdefghijklmnopqrstuvwxyz1234567890') as UpperName Inline [

Name

SONY1

JOHN235

HONY

PHILIPS

abc

xysdz

];

Capture.PNG

and in ur expression:

count({<Flag={1}>}Name)

kaushiknsolanki
Partner Ambassador/MVP

Try this.

Load *,Len(KeepChar(Name,'ABCDEFGHIJKLMNOPQRSTUVWXYZ')) as Count inline [

Name

SONY1

JOHN235

HONY

PHILIPS

abc

xysdz

];

Regards,

Kaushik Solanki

Please remember to hit the 'Like' button and for helpful answers and resolutions, click on the 'Accept As Solution' button. Cheers!
bhavvibudagam
Creator II
Author

Hi Kaushik,

Thanks for your reply.How to get the alpha numeric count in UI.

example in the above inline

SONY1

JOHN235 are alpahnumeric.

I need to get the count as 2.

kaushiknsolanki
Partner Ambassador/MVP

Try this

=Sum(Aggr(if(isnum(KeepChar(Name,'0123456789')) and IsText(Name),1,0),Name))

I am checking if it is num and text both, if yes then count.

Regards,

Kaushik Solanki

Please remember to hit the 'Like' button and for helpful answers and resolutions, click on the 'Accept As Solution' button. Cheers!
OmarBenSalem

I always prefer to create things in script; to use in the charts; It prevent Qlik from calculating each expression :

names:

load *, if(Name = UpperName, 1,0) as Flag , if (Name <> UpperName and len(Trim(UpperName))<>0,1,0) as FlagAlphaNum;

load *, PurgeChar(Name,'abcdefghijklmnopqrstuvwxyz1234567890') as UpperName Inline [

Name

SONY1

JOHN235

HONY

PHILIPS

abc

xysdz

];

Capture.PNG

with this, for alphaNum:

count({<FlagAlphaNum={1}>}Name)


for count cap:

count({<Flag={1}>}Name)