- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
extract text before delimiter
Hope someone can help me on this whether in Power Query or DAX.
My data is Title and ID columns.
1st scenario - I need to create a new column that extracts the data from TITLE field that does not ends with ":X"
The column no ":X" is the expected output
2nd scenario - I need to create a new column that extracts the data from TITLE field that does not ends with value corresponding to ID field. Delimiter is ":". Sample is 2nd row below ID field contains "1234" so I have to remove ":1234" from Title field.
Expected output columns are no ":X" and no ":[ID]"
Title | ID | no ":X" | no ":[ID]" | |||
Alabama:Montgomery:1234 | 1234 | Alabama:Montgomery:1234 | Alabama:Montgomery | |||
Alaska:Juneau:X | Alaska:Juneau | Alaska:Juneau:X | ||||
Arizona:Phoenix:X | Arizona:Phoenix | Arizona:Phoenix:X | ||||
Arkansas:LittleRock:Test:X | Arkansas:LittleRock:Test | Arkansas:LittleRock:Test:X | ||||
California:Sacramento:est:3854 | 3854 | California:Sacramento:est:3854 | California:Sacramento:est | |||
Colorado:Denver:2021 | Colorado:Denver:2021 | Colorado:Denver:2021 | ||||
Connecticut:X:Hartford:AAA | Connecticut:X:Hartford:AAA | Connecticut:X:Hartford:AAA | ||||
Delaware:Dover:Type:7877 | 7877 | Delaware:Dover:Type:7877 | Delaware:Dover:Type |
For scenario 1, this formula works but it also extracts wherever my delimiter can be found. I only need to extract data if it ENDS with the delimiter
Eg. Connecticut:X:Hartford:AAA my formula does not work here because the output becomes Connecticut
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi @summer18
Try below DAX expressions ,
1.
2.
Don't forget to give thumbs up and accept this as a solution if it helped you!!!
Thank you,
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
pls code in power query
Based on your description, I created data to reproduce your scenario. The pbix file is attached in the end.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi @summer18
Try below DAX expressions ,
1.
2.
Don't forget to give thumbs up and accept this as a solution if it helped you!!!
Thank you,
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Glad to know !
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
@summer18
Could you please give a thumbs up and accept this as a solution as well, since you confirmed that DAX is working too?

Helpful resources
Join us at the Microsoft Fabric Community Conference
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Power BI Monthly Update - February 2025
Check out the February 2025 Power BI update to learn about new features.

Subject | Author | Posted | |
---|---|---|---|
11-22-2024 09:21 AM | |||
10-22-2024 07:21 AM | |||
06-18-2024 07:41 AM | |||
02-24-2021 06:28 AM | |||
05-06-2024 05:14 AM |
User | Count |
---|---|
96 | |
62 | |
55 | |
49 | |
48 |