Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Transform Table II

Hi, need transform this table

IDnametypevalue
1Ablue10
1Ayellow50
3Cred80
3Cyellow60
4Dyellow40

In this:

IDnameyellowbluered
1A50100
3C60080
4D4000

Some idea.

Thanks.

4 Replies
jagan
Luminary Alumni
Luminary Alumni

HI,

Check the attached file.

Use ID, name, type as Dimensions.

and Sum(value) AS expression

Now drag type dimension horizontally.

Regards,

Jagan.

swuehl
MVP
MVP

If you want to do the transformation to a crosstable in the script, you could do it like:

INPUT:

LOAD ID,

     name,

     type,

     value

FROM

[http://community.qlik.com/thread/49321?tstart=0]

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

tmp:

Generic LOAD ID, name, type, value Resident INPUT;

Result:

load distinct ID, name resident INPUT;

drop table INPUT;

FOR i = 0 to NoOfTables()

TableList:

LOAD TableName($(i)) as Tablename AUTOGENERATE 1

WHERE WildMatch(TableName($(i)), 'tmp.*');

NEXT i

FOR i = 1 to FieldValueCount('Tablename')

LET vTable = FieldValue('Tablename', $(i));

LEFT JOIN (Result) LOAD * RESIDENT $(vTable);

DROP TABLE $(vTable);

NEXT i

drop table TableList;

Not applicable
Author

Sorry Jagan, I need do it in script.

Thanks a lot.

marcel_olmo
Partner Ambassador
Partner Ambassador

Hi Pedro how is it going?

In this case, I think the best way to solve it is using the GENERIC LOAD function. Which does a transpose of each field of the table and it links the common fields automatically.

Is quite useful.

Regards,  Marcel.