Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

Announcements
Qlik® Product Spotlight: Discover what’s possible. Get more from our products.
See for yourself. Register today.
carlospulgarinz
Not applicable

Count field Values

Hello

can someone help me with this?

I have this colum

Numero
a
a
b
b
b
c
c
c
q
q
q
q

and y need  someting like this:

 

NumeroCuenta
a1
a2
b1
b2
b3
c1
c2
c3
q1
q2
q3
q4
1 Solution

Accepted Solutions
maxgro
Not applicable

Re: Count field Values

Another option could be

Temp: 

LOAD * INLINE [ 

    Numero 

    a 

    a 

    b 

    b 

    b 

    c 

    c 

    c 

    q 

    q 

    q 

    q 

]; 

 

Data: 

LOAD Numero, 

  AutoNumber(Rowno(), Numero) as Cuenta

RESIDENT Temp; 

 

DROP TABLE Temp; 

4 Replies
Nicole-Smith
Not applicable

Re: Count field Values

In the load script, you can do something like this:

Temp:

LOAD * INLINE [

    Numero

    a

    a

    b

    b

    b

    c

    c

    c

    q

    q

    q

    q

];

Data:

LOAD Numero,

  IF(Numero = PREVIOUS(Numero), PEEK('Cuenta') + 1, 1) AS Cuenta

RESIDENT Temp;

DROP TABLE Temp;

maxgro
Not applicable

Re: Count field Values

Another option could be

Temp: 

LOAD * INLINE [ 

    Numero 

    a 

    a 

    b 

    b 

    b 

    c 

    c 

    c 

    q 

    q 

    q 

    q 

]; 

 

Data: 

LOAD Numero, 

  AutoNumber(Rowno(), Numero) as Cuenta

RESIDENT Temp; 

 

DROP TABLE Temp; 

carlospulgarinz
Not applicable

Re: Count field Values

Thank you Massimo Grossi,

this worked!!

maxgro
Not applicable

Re: Count field Values

Also Nicole's answer works.

When applicable please mark the appropriate replies as CORRECT. This will help community members and Qlik Employees know which discussions have already been addressed and have a possible known solution. Please mark threads as HELPFUL if the provided solution is helpful to the problem, but does not necessarily solve the indicated problem. You can mark multiple threads as HELPFUL if you feel additional info is useful to others.