Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more

Reply
radoslaw85
Regular Visitor

Finding position of list items within specific text

Hello.
Im trying to do following.

In specific row of data in Table I have a text:
"A   B C        D     E"

if I manualy count the positions of which each letter starts (counting from 0) i get:
0, 4, 6, 15, 21.

Now In some step I already cleaned this and splited it into a list:
{"A","B","C","D","E"}

Now Im trying to write an Mcode that would give me the same starting posiotions of: 0, 4, 6, 15, 21
but automated since the amount of spaces could change.
I tried few things and nothing helps.

I think the best option is something like:
Table.AddColumn(
Table.FirstN(
Table.SelectColumns( Custom1, "Column1"),1),
"Positions", each
List.PositionOf(Custom2, true, Occurrence.All))

However this gives an empty list instead of list of values.
Can any1 advise on how to find position within text of all values in the list?

Thank you




1 ACCEPTED SOLUTION
radoslaw85
Regular Visitor

yeah after remembring something from BI Gorilla It worked:

= Table.AddColumn(
Table.FirstN(
Table.SelectColumns( Custom1, "Column1"),1),"Positions", each
List.Transform(Custom2, (STR) => Text.PositionOf([Column1], STR ) ) )

View solution in original post

1 REPLY 1
radoslaw85
Regular Visitor

yeah after remembring something from BI Gorilla It worked:

= Table.AddColumn(
Table.FirstN(
Table.SelectColumns( Custom1, "Column1"),1),"Positions", each
List.Transform(Custom2, (STR) => Text.PositionOf([Column1], STR ) ) )

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Kudoed Authors