Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Linha para Coluna

Galera,

no SQL existe uma função chamada STUFF. Essa função me possibilita transformar linhas em coluna mesclada. Exemplo.

Users per sector sales ->>>>>> sample output

Mediante as informações apresentadas, preciso apresentar o campo USR_NAMES numa pivot de forma linear no Qlik.

Alguém saberia me informar se existe alguma função para executar essa operação?

Desde já obrigado pela ajuda!

Labels (1)
1 Solution

Accepted Solutions
sunny_talwar

Opposite can be achieved using this:

Table:

LOAD SEC_NAME,

    USR_NAMES

FROM

Community_158934.xls

(biff, embedded labels, table is Sheet1$);

Table1:

NoConcatenate

LOAD SEC_NAME,

  Concat(USR_NAMES, ', ') as USR_NAMES

Resident Table

Group By SEC_NAME;

DROP Table Table;


Best,

Sunny

View solution in original post

5 Replies
sunny_talwar

Try with SubField function in the script:

Table:

LOAD * INLINE [

    SEC_NAME, USR_NAMES

    CLOTHES, "KEITH, STEFAN, EDUARD, BRAD"

    ENTERTAINMENT, "ANDERSON, CHARLES, DANNY LUCAS"

];

Table1:

NoConcatenate

LOAD SEC_NAME,

  SubField(USR_NAMES, ', ', IterNo()) as USR_NAMES

Resident Table

While (IterNo() <= SubStringCount(USR_NAMES, ', ') + 1);

DROP Table Table;


Best,

Sunny

Not applicable
Author

Eu precisaria fazer o inverso.

DE

SEC_NAMEUSR_NAMES
CLOTHESBRAD
CLOTHESEDUARD
CLOTHESKEITH
CLOTHESSTEFAN
ENTERTAINMENTANDERSON
ENTERTAINMENTCHARLES
ENTERTAINMENTDANNY LUCAS

PARA

SEC_NAMEUSR_NAMES
CLOTHESBRAD, EDUARD, KEITH, STEFAN
ENTERTAINMENTANDERSON, CHARLES, DANNY LUCAS
sunny_talwar

Opposite can be achieved using this:

Table:

LOAD SEC_NAME,

    USR_NAMES

FROM

Community_158934.xls

(biff, embedded labels, table is Sheet1$);

Table1:

NoConcatenate

LOAD SEC_NAME,

  Concat(USR_NAMES, ', ') as USR_NAMES

Resident Table

Group By SEC_NAME;

DROP Table Table;


Best,

Sunny

Not applicable
Author

Galera,

consegui resolver com o comando concat(USR_NAMES,';').

Obrigado pela ajuda!

sunny_talwar

I am glad I was able to help.

Best,

Sunny