Power BI is turning 10, and we’re marking the occasion with a special community challenge. Use your creativity to tell a story, uncover trends, or highlight something unexpected.
Get startedJoin us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.
Hi,
I have this string in a column:
A*B*C*A*C
Then I have this table:
Code | Description |
A | Blue |
B | Green |
C | Red |
D | Yellow |
I would like to create a column where the result picks the description from the table.
The result should be like this:
Blue*Green*Red*Blue*Red
I would really appreciate if you could help me with a dax for this.
Thanks!
Solved! Go to Solution.
@coejnot
You can add a custom column in Power Query and achieve the same. File is attached
Text.Combine(
List.Transform(
Text.Split([Column1],"*"),(a)=> Text.Replace(a,a, Table.SelectRows( Table2, (i)=> i[Code] = a)[Description]{0})),"*")
)
⭕ Subscribe and learn Power BI from these videos
⚪ Website ⚪ LinkedIn ⚪ PBI User Group
@coejnot
You can add a custom column in Power Query and achieve the same. File is attached
Text.Combine(
List.Transform(
Text.Split([Column1],"*"),(a)=> Text.Replace(a,a, Table.SelectRows( Table2, (i)=> i[Code] = a)[Description]{0})),"*")
)
⭕ Subscribe and learn Power BI from these videos
⚪ Website ⚪ LinkedIn ⚪ PBI User Group
This worked really well, thank you!
@coejnot I realize that this is already solved and @Fowmy solution is the best one. However, I couldn't help creating a DAX solution for this. The solution is based on my Text to Table measure:
Column =
VAR __Separator = "*"
VAR __SearchText = [Column1]
VAR __Len = LEN(__SearchText)
VAR __Count = __Len - LEN(SUBSTITUTE(__SearchText,__Separator,"")) + 1
VAR __Table =
ADDCOLUMNS(
ADDCOLUMNS(
GENERATESERIES(1,__Count,1),
"__Word",
VAR __Text = SUBSTITUTE(__SearchText,__Separator,"|",IF([Value]=1,1,[Value]-1))
VAR __Start =
SWITCH(TRUE(),
__Count = 1,1,
[Value] = 1,1,
FIND("|",__Text)+1
)
VAR __End =
SWITCH(TRUE(),
__Count = 1,__Len,
[Value] = 1,FIND("|",__Text) - 1,
[Value] = __Count,__Len,
FIND(__Separator,__Text,__Start)-1
)
VAR __Word = MID(__Text,__Start,__End - __Start + 1)
RETURN __Word
),
"__Replaced",LOOKUPVALUE('Table'[Description],'Table'[Code],[__Word])
)
RETURN
CONCATENATEX(__Table,[__Replaced],__Separator,[Value])
Hi, @Greg_Deckler
I tried this out too, and it also works as I expected.
Interesting to learn even more about how to create things in DAX.
Thank you!
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
11 | |
9 | |
8 | |
8 | |
7 |
User | Count |
---|---|
14 | |
12 | |
11 | |
10 | |
9 |