Hi Team,
i have source table like this.I want to convert like target table.by using script
Source Table:
Jan | Feb | Mar | |
CAMIRINI | 17,532 | 15,280 | 17,876 |
LAMICS | 10,164 | 9,171 | 10,520 |
LAMICS GEN | 7,368 | 9,171 | 7,356 |
EMI ROMA | 5,831 | 9,171 | 56,582 |
LAMICS | 3,682 | 9,171 | 3,576 |
LAMICS GEN | 2,149 | 9,171 | 2,234 |
LAZO | 10,043 | 9,171 | 10,429 |
LAMICS | 7,132 | 9,171 | 7,325 |
LAMICS GEN | 2,911 | 9,171 | 3,104 |
LOMBA | 15,604 | 9,171 | 15,816 |
LAMICS | 8,640 | 9,171 | 8,510 |
LAMICS GEN | 6,964 | 9,171 | 7,307 |
PIEME+VALLE | 7,451 | 9,171 | 7,444 |
LAMICS | 4,156 | 9,171 | 4,170 |
LAMICS GEN | 3,295 | 9,171 | 3,274 |
Target Table:
REGION | BRAND | Jan | Feb | Mar |
CAMIRINI | 17,532 | 15,280 | 17,876 | |
CAMIRINI | LAMICS | 10,164 | 9,171 | 10,520 |
CAMIRINI | LAMICS GEN | 7,368 | 9,171 | 7,356 |
EMI ROMA | 5,831 | 9,171 | 56,582 | |
EMI ROMA | LAMICS | 3,682 | 9,171 | 3,576 |
EMI ROMA | LAMICS GEN | 2,149 | 9,171 | 2,234 |
LAZO | 10,043 | 9,171 | 10,429 | |
LAZO | LAMICS | 7,132 | 9,171 | 7,325 |
LAZO | LAMICS GEN | 2,911 | 9,171 | 3,104 |
LOMBA | 15,604 | 9,171 | 15,816 | |
LOMBA | LAMICS | 8,640 | 9,171 | 8,510 |
LOMBA | LAMICS GEN | 6,964 | 9,171 | 7,307 |
PIEME | 7,451 | 9,171 | 7,444 | |
PIEME | LAMICS | 4,156 | 9,171 | 4,170 |
PIEME | LAMICS GEN | 3,295 | 9,171 | 3,274 |
I want to convert Like Target table.how can i do that in qliksesne script level.
Thanks
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