Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
selvakumarsr
Creator
Creator

Listing values horizontally

Hi All,

I want to list values in Pivot or Straight Table Horizontally. Is it possible?

I have tried cross table transformation but i'm not getting the expected output

Input Table:

SIDPL
S001123
S001456
S002345
S002888
S002777

Expected Output:

SIDPLPLPL
S001123456-
S002345888777

Thanks,

Selva

Labels (1)
1 Solution

Accepted Solutions
vinieme12
Champion III
Champion III

OR if you want to show just in front end then this is enough

temp:

LOAD SID,

     PL,

     'PL'&AutoNumber(PL,SID) as InstanceName,

      AutoNumber(PL,SID) as InstanceNum

FROM

[https://community.qlik.com/thread/300412]

(html, codepage is 1252, embedded labels, table is @1);

then use a Pivot Chart with SID  and InstanceName as Dimension

Capture.PNG

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.

View solution in original post

5 Replies
gayandilhara
Contributor II
Contributor II

Did you manage to get the table 1 to appear on QV? Normally I would expect the PL values to to aggregated for each SID eg: S001 -> 123 + 456. Maybe would help if you post the data model?

However in the expected output, you might be able to get the details as specified if you have a specific criteria for each column eg: PL1 = sum of all SID where condition = 1 etc.

Anil_Babu_Samineni
MVP
MVP

Can i know the reason why you want to split only 3 columns from single Column? May be explain

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
selvakumarsr
Creator
Creator
Author

Hi Anil,

It will be multiple (n number) of columns. For example i entered 3.

Thanks,

Selva

vinieme12
Champion III
Champion III

If you want to do this in script then use below

temp:

LOAD SID,

     PL,

     AutoNumber(PL,SID) as Instance

FROM

[https://community.qlik.com/thread/300412]

(html, codepage is 1252, embedded labels, table is @1);


t2:

load max(Instance) as NoOfCol

Resident temp;


let vNoOfCols = Peek('NoOfCol');



for i = 1 to $(vNoOfCols)

let vFieldName = 'PL'&$(i);


if $(i)=1 THEN

FACT:

LOAD DISTINCT SID

Resident temp;

Left Join(FACT)

LOAD SID

,PL as $(vFieldName)

Resident temp

Where Instance =$(i);


ELSE

Left Join(FACT)

LOAD SID

,PL as $(vFieldName)

Resident temp

Where Instance =$(i);


End if

Next i;


Drop table temp,t2;






Capture.PNG

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.
vinieme12
Champion III
Champion III

OR if you want to show just in front end then this is enough

temp:

LOAD SID,

     PL,

     'PL'&AutoNumber(PL,SID) as InstanceName,

      AutoNumber(PL,SID) as InstanceNum

FROM

[https://community.qlik.com/thread/300412]

(html, codepage is 1252, embedded labels, table is @1);

then use a Pivot Chart with SID  and InstanceName as Dimension

Capture.PNG

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.