Skip to main content
Announcements
Qlik Connect 2025: 3 days of full immersion in data, analytics, and AI. May 13-15 | Orlando, FL: Learn More
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

how to convert rows into columns

Hello All,

I have some data in excel as below

                                                                                                                                                                                                                                                     
DateTimeOpenHighLowCloseClose Higher1HClose1HHigh1HLow1LClose1LHigh1LLow1Close Higher2HClose2HHigh2HLow2LClose2LHigh2LLow2Close Higher3HClose3HHigh3HLow3LClose3LHigh3LLow3Close Higher4HClose4HHigh4HLow4LClose4LHigh4LLow4Close Higher5HClose5HHigh5HLow5LClose5LHigh5LLow5
2008.12.0314:001.2621.26431.261.262810.000100.00240-0.00120FALSEFALSEFALSE10.005900.00600-0.00150FALSEFALSEFALSE10.004200.006300.00280FALSEFALSEFALSE10.003700.005200.00050FALSEFALSEFALSE10.002700.004300.00180FALSEFALSEFALSE

DateTimeOpenHighLowCloseClose Higher1HClose1HHigh1HLow1LClose1LHigh1LLow1Close Higher2HClose2HHigh2HLow2LClose2LHigh2LLow2Close Higher3HClose3HHigh3HLow3LClose3LHigh3LLow3Close Higher4HClose4HHigh4HLow4LClose4LHigh4LLow4Close Higher5HClose5HHigh5HLow5LClose5LHigh5LLow5
2008.12.0314:001.2621.26431.261.262810.000100.00240-0.00120FALSEFALSEFALSE10.005900.00600-0.00150FALSEFALSEFALSE10.004200.006300.00280FALSEFALSEFALSE10.003700.005200.00050FALSEFALSEFALSE10.002700.004300.00180FALSEFALSEFALSE

Now while loading this data through loadscript, I want to convert Close Higher1 to LLow1 into a new column Bar1, (Close Higher2.........LLow2) into Bar 2 and  so on. I know how to covert data from a specific column till end into a single column, but i am not sure how to covert portion of row into a column. Can someone please help me.

Thanks

Arif

6 Replies
jvitantonio
Luminary Alumni
Luminary Alumni

Try the load statement from file (in Edit Script) and play with the funcionalities

Not applicable
Author

I have tried the cross tab while loading excel but it converts all the remaining rows except qualifiers into one single column. I dont want them in one single column. i want that after first four qualifier columsn every five columns be converted into single column as i mentioned above

Thanks

Arif

chriscammers
Partner - Specialist
Partner - Specialist

Arif,

Could you show what you want the data to look like. I am thinking you have to use a combination of joins and cross table but I'm not clear on what you are looking to see.

Chris

Not applicable
Author

Hello Chris,

I want the data to look like this

DateTimeOpenHighLowCloseBar1Bar2Bar3Bar4Bar5
2008.12.0314:001.2621.26431.261.262811111
2008.12.0314:001.2621.26431.261.26280.000100.005900.004200.003700.00270
2008.12.0314:001.2621.26431.261.26280.002400.006000.006300.005200.00430
2008.12.0314:001.2621.26431.261.2628-0.00120-0.001500.002800.000500.00180
2008.12.0314:001.2621.26431.261.2628FALSEFALSEFALSEFALSEFALSE
2008.12.0314:001.2621.26431.261.2628FALSEFALSEFALSEFALSEFALSE
2008.12.0314:001.2621.26431.261.2628FALSEFALSEFALSEFALSEFALSE

After the first six columns, all the columns with postfix 1 (Close Higher1,HClose1,HHigh1,HLow1,LClose1,LHigh1,LLow1) are under bar1 and (Close Higher2,HClose2,HHigh2,HLow2,LClose2,LHigh2,LLow2) are under bar2 and so on. I hope this is clear now. let me know if i need to explain it some other way

Br

Arif

matteo_mi
Partner - Contributor III
Partner - Contributor III

You should use concatenate load

Not applicable
Author

Edit: Updated

Hi,

You have to split the table and load it multiple times to achieve this.

You can try using:

Crosstable(PostFixBar1, PostFix1_Values, 6)

Load

Date,

Time,

Open,

High,

Low,

Close

Close Higher1,

HClose1,

HHigh1,

HLow1,

LClose1,

LHigh1,

LLow1

From

SourceFileName;

Crosstable(PostFixBar2, PostFix2_Values, 1)

Load

Date ,

[Close Higher2],

HClose2,

HHigh2,

HLow2,

LClose2,

LHigh2,

LLow2

From SourceFileName;

Crosstable(PostFixBar3, PostFix3_Values, 1)

Load

Date,

Close Higher3,

HClose3,

High3,

HLow3,

LClose3,

LHigh,

LLow3

From SourceFileName;

.

.........

............

.................and so on.

You could use the same procedure to transform all the columns in a similar way.

Hope that helps.

-Khaled