Forum Discussion
aridavid
5 years agoFrequent Visitor
Split column in multiple columns based on text
Hello, Is there a way I can split or extract text from a column with concateneated strings, and put it into multiple columns based on the text/strings? For example: My sources comes like this...
- Anonymous5 years ago
Here are the steps you can follow:
1. Create calculated column.
Profile = var _first=LEFT('Table'[Labels],FIND(",",'Table'[Labels])-1) var _last=RIGHT('Table'[Labels],FIND(",",'Table'[Labels])+1) var _StringLength=LEN('Table'[Labels]) var _Secondtolast= TRIM( LEFT( RIGHT( SUBSTITUTE('Table'[Labels], ",",REPT(" ",_StringLength)) , _StringLength *2 ),_StringLength)) return SWITCH( TRUE(), 'Table'[ID]=1,_first&","&_last, 'Table'[ID]=2,_first&","&_last, 'Table'[ID]=3,_Secondtolast&","&_last) Site = var _StringLength=LEN('Table'[Labels]) var _Secondtofirst= TRIM( LEFT( RIGHT( SUBSTITUTE('Table'[Labels], ",",REPT(" ",_StringLength)) , _StringLength *3 ),_StringLength)) var _Secondtolast= TRIM( LEFT( RIGHT( SUBSTITUTE('Table'[Labels], ",",REPT(" ",_StringLength)) , _StringLength *2 ),_StringLength)) var _3second= TRIM( LEFT( RIGHT( SUBSTITUTE('Table'[Labels], ",",REPT(" ",_StringLength)) , _StringLength *4 ),_StringLength)) return SWITCH( TRUE(), 'Table'[ID]=1,_Secondtofirst, 'Table'[ID]=2,_Secondtofirst&","&_Secondtolast, 'Table'[ID]=3,_3second&","&_Secondtofirst) Priority = var _StringLength=LEN('Table'[Labels]) var _first=LEFT('Table'[Labels],FIND(",",'Table'[Labels])-1) var _Secondtofirst= TRIM( LEFT( RIGHT( SUBSTITUTE('Table'[Labels], ",",REPT(" ",_StringLength)) , _StringLength *2 ),_StringLength)) return SWITCH( TRUE(), 'Table'[ID]=1,_Secondtofirst, 'Table'[ID]=2,BLANK(), 'Table'[ID]=3,_first)2. Result:
Best Regards,
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly
Anonymous
5 years agoNot applicable
Here are the steps you can follow:
1. Create calculated column.
Profile =
var _first=LEFT('Table'[Labels],FIND(",",'Table'[Labels])-1)
var _last=RIGHT('Table'[Labels],FIND(",",'Table'[Labels])+1)
var _StringLength=LEN('Table'[Labels])
var _Secondtolast=
TRIM(
LEFT(
RIGHT(
SUBSTITUTE('Table'[Labels],
",",REPT(" ",_StringLength))
, _StringLength *2
),_StringLength))
return
SWITCH(
TRUE(),
'Table'[ID]=1,_first&","&_last,
'Table'[ID]=2,_first&","&_last,
'Table'[ID]=3,_Secondtolast&","&_last)
Site =
var _StringLength=LEN('Table'[Labels])
var _Secondtofirst=
TRIM(
LEFT(
RIGHT(
SUBSTITUTE('Table'[Labels],
",",REPT(" ",_StringLength))
, _StringLength *3
),_StringLength))
var _Secondtolast=
TRIM(
LEFT(
RIGHT(
SUBSTITUTE('Table'[Labels],
",",REPT(" ",_StringLength))
, _StringLength *2
),_StringLength))
var _3second=
TRIM(
LEFT(
RIGHT(
SUBSTITUTE('Table'[Labels],
",",REPT(" ",_StringLength))
, _StringLength *4
),_StringLength))
return
SWITCH(
TRUE(),
'Table'[ID]=1,_Secondtofirst,
'Table'[ID]=2,_Secondtofirst&","&_Secondtolast,
'Table'[ID]=3,_3second&","&_Secondtofirst)
Priority =
var _StringLength=LEN('Table'[Labels])
var _first=LEFT('Table'[Labels],FIND(",",'Table'[Labels])-1)
var _Secondtofirst=
TRIM(
LEFT(
RIGHT(
SUBSTITUTE('Table'[Labels],
",",REPT(" ",_StringLength))
, _StringLength *2
),_StringLength))
return
SWITCH(
TRUE(),
'Table'[ID]=1,_Secondtofirst,
'Table'[ID]=2,BLANK(),
'Table'[ID]=3,_first)
2. Result:
Best Regards,
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly