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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
graemejohnson
Helper II
Helper II

Get last value from an delimited set of values

I have a column in a table which contains zero, one or more delimited values.  I want to extract value on the right hand side of the last delimiter if there is a delimer...for example the values highlighted in yellow below....

 

This is tying me up in knots trying to crack it Smiley Frustrated - please can someone help?

 

2019-08-01_17h05_27.png

1 ACCEPTED SOLUTION

Well, having had a further sniff around....I saw the 'Extract' option - and used that functionality to grab the last value 

Also then had to change the data type to a Whole Number

Seems a neat solution

 

2019-08-02_09h06_59.png2019-08-02_09h27_21.png

View solution in original post

3 REPLIES 3
Anonymous
Not applicable

This type of thing is much easier in Power Query in my view. Assuming that's an option:

 

1.  Add a custom column that will give you  the position of the last delimiter

Text.PositionOfAny([Column1],{","}, Occurrence.Last)

Custom Col Last Occurrance.png

 

2. Custom column to get the text lenght of Column 1

Text.Length([Column1])

3. Final custom column to get the value of the last delimited value

if
[Position of Last Delimiter] < 0
then 
[Column1]
else Text.End([Column1],([Text Length]-[Position of Last Delimiter]-1)
)

Basically it's saying that is the position of last delimiter is negative (which means there is no delimiter) then give the value in that row. Else, start at the end of values in the current row, and go back to you find the first delimiter (which would be the last delimiter) 

 

Final Table:

Final Table.png

 

You could easily combine #1 and #2 into one step, but left them on here to show the idea. 

Well, having had a further sniff around....I saw the 'Extract' option - and used that functionality to grab the last value 

Also then had to change the data type to a Whole Number

Seems a neat solution

 

2019-08-02_09h06_59.png2019-08-02_09h27_21.png

Anonymous
Not applicable

Use Power Query for this. Not DAX. DAX is a data analysis language, not data manipulation language. M is.

Best
Darek

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.