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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
Anonymous
Not applicable

How to reference column value within M function?

Hello everybody,

 

I am trying to extract the respective Type and Category value based on the Attribute number ("|" being the delimiter). To accomplish this, I am using the Text.BetweenDelimiters function. If the attribute is 1, for example, I want to extract the value between the first and the second delimiter. If the attribute is 2, I want to extract the value between the second and the third delimiter.

 

However, I am unable to reference the attribute column. The code below returns an error. How do we reference columns within M functions?

 

Text.BetweenDelimiters(_, "|", "|", each [Attribute]-1, 0)

 

01.png

2 ACCEPTED SOLUTIONS
v-chuncz-msft
Community Support
Community Support

@Anonymous 

 

You may change it as follows.

Text.BetweenDelimiters([Category], "|", "|",  [Attribute]-1, 0)
Community Support Team _ Sam Zha
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

Anonymous
Not applicable

Thanks for your reply!

 

I managed to figure it out myself after I started this thread:

 

Text.BetweenDelimiters([Category],"|","|",(Int64.From([Attribute]))-1,0)

I needed the Int64 data type to have the function accept the value from the Attribute column.

 

Thanks again!

View solution in original post

2 REPLIES 2
v-chuncz-msft
Community Support
Community Support

@Anonymous 

 

You may change it as follows.

Text.BetweenDelimiters([Category], "|", "|",  [Attribute]-1, 0)
Community Support Team _ Sam Zha
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
Not applicable

Thanks for your reply!

 

I managed to figure it out myself after I started this thread:

 

Text.BetweenDelimiters([Category],"|","|",(Int64.From([Attribute]))-1,0)

I needed the Int64 data type to have the function accept the value from the Attribute column.

 

Thanks again!

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

Find out what's new and trending in the Fabric Community.