Forum Discussion
samroth
6 years agoMicrosoft Employee
Create column based off substrings from different table
I have two tables. The first is my main table with a bunch of information on items. One of the columns is an "Area Path". The following is a made-up example with similar information to what can be...
Greg_Deckler
6 years agoCommunity Champion
samroth - I did it this way (below). PBIX is attached below sig.
Column =
VAR __Table =
ADDCOLUMNS(
ALL('Table (4)'[Root Path]),
"Depth",LEN([Root Path]) - LEN(SUBSTITUTE([Root Path],"\","")),
"Match",FIND([Root Path],[Area Path],,0)
)
VAR __BestDepth = MAXX(FILTER(__Table,[Match]>0),[Depth])
RETURN
MAXX(FILTER(__Table,[Match]>0 && [Depth] = __BestDepth),[Root Path])
samroth
6 years agoMicrosoft Employee
Thanks Greg, where I am supposed to put this code to run in the pbix?
- v-easonf-msft5 years agoCommunity Support
Hi , samroth
As shown in the attached file provided by Greg_Deckler ,you just need to create a calculated column.
Best Regards,
Community Support Team _ Eason
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.