Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi all,
Very easy question. How combine 2 variable in 1 in load?
Var1 | Var2 |
0 | |
4 | |
7 | |
9 | |
2 | |
6 | |
8 | |
4 | |
9 | |
10 | |
3 | |
7 | |
5 |
Thanks,
Then you have to use if() function:
if(len(trim(Var1))=0, Var2, Var1)
- Ralf
If you want to combine the columns, you could do this:
Var 1 & '' & Var 2 as Var12
You could do this on import or add it as a dimension afterwards.
Best,
Matt
Hi Vladimir,
if this is a two column source and either Var1 or Var2 is null or empty you can just concatenate by "&" and then convert to number:
LOAD num(num#(Var1 & Var2)) as Result ...;
- Ralf
Thanks guys for your help.
For some records I have duplicate
ID | Var1 | Var2 | Result |
8028000027015020 | 10 | 10 | |
8028000027015160 | 8 | 8 | |
8028000027015450 | 4 | 4 | |
8028000027015590 | 1 | 1 | 11 |
8028000027015600 | 1 | 1 | 11 |
8028000027016060 | 10 | 10 | 1010 |
8028000027016210 | |||
8028000027017560 | 10 | 10 | |
8028000027017700 | 0 | 0 | |
8028000027017780 | |||
8028000027017840 | 5 | 5 |
I need only 1 number. Use condition If? or maybe you more logical function?
Thanks,
Better try alt() function:
LOAD alt(Var1,Var2) as Result ...;
- Ralf
Thanks Ralf,
It works!!!
Alt doesn't work with string variable?
alt("Var1_number","Var2_number") as "Result1", works
alt("Var3_string","Var4_string") as "Result2", doesn't work
it keeps only last variable data.
Of course alt() function is for numeric data, please take a look into the help.
Therefor, this should work:
LOAD alt(num#(Val1), num#(Val2)) as Result ..
- Ralf
Ok, thanks.
It didn't work
Please see attached example with your data..
Thanks Ralf for sharing the file.
I don't have problem with alt function for numeric variable.
I need to do the same for string variable.
Thanks again.