Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
fmazzarelli
Partner - Creator III
Partner - Creator III

howto: transpose

hi,

a file excel is organized

Student       Genuary     February

Fabio           1100               2000

          

is it possibile transpose a row as column?

MONTH            Student     t

Genuary            1100

February            2000

Thanks

4 Replies
rubenmarin

Hi Fabio, you can use CrossTable(), ie:

Data:

CrossTable(Month, Value)

LOAD Student,

    Genuary,

    February;

LOAD * Inline [

Student,Genuary,February

Fabio,1100,2000

];

This will create a table like:

Month Student Value
FebruaryFabio2000
GenuaryFabio1100
pokassov
Specialist
Specialist

Hello!

Look for CrossTable

MarcoWedel

Hi,

you might also load using * to avoid hard coded field names:

Data:

CrossTable(Month, Value)

LOAD * Inline [

Student,Genuary,February

Fabio,1100,2000

];

hope this helps

regards

Marco

MarcoWedel

to get a "real" Month field (no sorting/calculation issues!), you could extend this solution like:

Data:

CrossTable(MonthTemp, Value)

LOAD * Inline [

Student,Genuary,February

Fabio,1100,2000

];

Left Join

LOAD distinct

     MonthTemp,

     Month(Date#(MonthTemp,'MMMM')) as Month

Resident Data;

Drop Field MonthTemp;

because CrossTable() always treats column names as text.

To implement this solution you could have to define your LongMonthNames variable accordingly (if not already done):

SET LongMonthNames = 'Genuary,February, ... ';

hope this helps

regards

Marco