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

Announcements
Posting on Qlik Community is temporarily paused. Thank you for patience and we'll update you soon!
cancel
Showing results for 
Search instead for 
Did you mean: 
mario-sarkis
Creator II
Creator II

Crosstab

Hey all I need to Crosstab a table here is a similar example of my current situation noting that in my real case I have more date:

current Table:

   

IDDateStatus
101/01/2017Open
201/01/2017Intiated
301/01/2017Closed
102/01/2017Closed
202/01/2017Open
302/01/2017Closed

Output:

   

ID01/01/201702/01/2017
1Open Closed
2IntiatedOpen
3ClosedClosed
Labels (1)
1 Solution

Accepted Solutions
sunny_talwar
MVP
MVP

May be try this

Table:

LOAD * INLINE [

    ID, Date, Status

    1, 01/01/2017, Open

    2, 01/01/2017, Intiated

    3, 01/01/2017, Closed

    1, 02/01/2017, Closed

    2, 02/01/2017, Open

    3, 02/01/2017, Closed

];

FinalTable:

LOAD Distinct ID

Resident Table;

FOR i = 1 to FieldValueCount('Date')

  vField = FieldValue('Date', $(i));

  Left Join (FinalTable)

  LOAD ID,

  Status as [$(vField)]

  Resident Table

  Where Date = '$(vField)';

NEXT

DROP Table Table;

View solution in original post

2 Replies
sunny_talwar
MVP
MVP

May be try this

Table:

LOAD * INLINE [

    ID, Date, Status

    1, 01/01/2017, Open

    2, 01/01/2017, Intiated

    3, 01/01/2017, Closed

    1, 02/01/2017, Closed

    2, 02/01/2017, Open

    3, 02/01/2017, Closed

];

FinalTable:

LOAD Distinct ID

Resident Table;

FOR i = 1 to FieldValueCount('Date')

  vField = FieldValue('Date', $(i));

  Left Join (FinalTable)

  LOAD ID,

  Status as [$(vField)]

  Resident Table

  Where Date = '$(vField)';

NEXT

DROP Table Table;

MarcoWedel
MVP
MVP

Hi,

a (not recommended) script solution would be:

QlikCommunity_Thread_255167_Pic1.JPG

table1:

Generic

LOAD ID,

    Date,

    Status

FROM [https://community.qlik.com/thread/255167] (html, codepage is 1252, embedded labels, table is @1);

If you just want to present your output table in the front end, then you could use a pivot table, leaving your source table structure as is:

QlikCommunity_Thread_255167_Pic2.JPG

hope this helps

regards

Marco