Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

Announcements
Customers, Partners & Luminaries only: You're invited to a Data Analytics Roadmap session. Read More
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Contributor III
Contributor III

split one column into 2 columns

Hi Team,

i have source table like this.I want to convert like target table.by  using script

Source Table:

 JanFebMar
CAMIRINI17,53215,28017,876
   LAMICS10,1649,17110,520
   LAMICS GEN7,3689,1717,356
EMI ROMA5,8319,17156,582
   LAMICS3,6829,1713,576
   LAMICS GEN2,1499,1712,234
LAZO10,0439,17110,429
   LAMICS7,1329,1717,325
   LAMICS GEN2,9119,1713,104
LOMBA15,6049,17115,816
   LAMICS8,6409,1718,510
   LAMICS GEN6,9649,1717,307
 PIEME+VALLE7,4519,1717,444
   LAMICS4,1569,1714,170
   LAMICS GEN3,2959,1713,274

 

Target Table:

REGIONBRANDJanFebMar
CAMIRINI 17,53215,28017,876
CAMIRINI   LAMICS10,1649,17110,520
CAMIRINI   LAMICS GEN7,3689,1717,356
EMI ROMA   5,8319,17156,582
EMI ROMA   LAMICS3,6829,1713,576
EMI ROMA   LAMICS GEN2,1499,1712,234
LAZO 10,0439,17110,429
LAZO   LAMICS7,1329,1717,325
LAZO   LAMICS GEN2,9119,1713,104
LOMBA 15,6049,17115,816
LOMBA   LAMICS8,6409,1718,510
LOMBA   LAMICS GEN6,9649,1717,307
 PIEME 7,4519,1717,444
 PIEME   LAMICS4,1569,1714,170
 PIEME   LAMICS GEN3,2959,1713,274

 

I want to convert Like Target table.how can i do that in qliksesne script level.

 

Thanks

1 Reply
Highlighted
Creator III
Creator III

Hi, check out the script below

Data:
LOAD
	If(Left(Region,1) = Chr(160), Peek(Region), Region) as Region,
    If(Left(Region,1) = Chr(160), Region) as Brand,
    Jan,
    Feb,
    Mar;
LOAD
    F1 as Region,
    Jan,
    Feb,
    Mar
FROM [lib://Data/Data.xlsx]
(ooxml, embedded labels, table is Sheet1);

 I assume that the leading spaces before LAMICS are hard space characters (ASCII = 160). Data file used in the script is also attached.

Hope this helps.

BR,

Vu Nguyen