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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
SergioHB
Helper I
Helper I

Parsed Filename and Extension as Column

Hi all,

 

I have a .csv file that contains a path and filenames in it and I need to extract the file extensions in a different column. The thing here is that some of those paths contains data with multiple separators in it, then I can't rely on the Text.AfterDelimiter function as this is returning the part of the string after the first delimiter and also, cannot use the Text.End as there are extensions with two, three and four letters in it.

 

I guess by searching from the end of the path until it finds the first separator ('.') would be enough to return the correct value, but I can't make it.

 

Appreciate any help on this. Leave some examples of the info.

 

./TEST_PNG_File-0.png.Thumbnail.jpg
./TEST2_PNG_File-0.png.SmallImage.jpg
File.TEST ai..ai

 

Thanks

Sergio

 

1 ACCEPTED SOLUTION
AilleryO
Memorable Member
Memorable Member

Hi,

 

If you use on Power Query the split Column button (tab Home),

you have an option to select to use the most left or most right delimiter.

If you use the most right, it should work.

Check that your column, is of Text type, to have all options available.

 

Let us know if it works,

 

View solution in original post

3 REPLIES 3
msauriol
New Member

Another way I found is to duplicate the filename column into a new extension column, then use extract before (file) and after (ext) the delimiter, on the filename and extension columns. Specify the period as the delimiter in the extract screen, and under Advanced, select from the end of the input for both left and right filename parts.

AilleryO
Memorable Member
Memorable Member

Hi,

 

If you use on Power Query the split Column button (tab Home),

you have an option to select to use the most left or most right delimiter.

If you use the most right, it should work.

Check that your column, is of Text type, to have all options available.

 

Let us know if it works,

 

Works really good @AilleryO .

 

Thanks for your help and quick reply.

 

Stay safe.

Sergio

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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

Top Solution Authors
Top Kudoed Authors