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

Score big with last-minute savings on the final tickets to FabCon Vienna. Secure your discount

Reply
sanjayarun55
Frequent Visitor

Extract text from cell based on delimiter

Hi All,

 

I am using direct query in my power BI dashboard. what i am trying to do is create a column based in text extracted from another column called group.

Group: 

AVL_MPIP_R(0,5)

ALV_1_MPIP_R(0,5)

AVL_SPIP_R(0,7)

AVL_1_SPIP_R(0,95) and so on

group is always (3chars)_(4chars)_(remaining chars) or  (3chars)_(1or2)_(4chars)_(remaining chars)

 

1) Need the text after the last demiliter as a separate column 
2) need the text (MPIP) after AVL_ or sometimes AVL_1 in a new column. MPIP is always of same length. the only change is the for some cells the _1 comes and for some it doesnt. 

please note i am using direct query and pretty new to power bi, so ideally would like it as a step in transform data. if thats not possible maybe as a calculated column in my table

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @sanjayarun55 

Please try the following calculate column:

ExtractedText = 
VAR FullString = 'Table'[Group]
VAR StartPosition = 
    IF(
        MID(FullString, 5, 1) = "1",
        7,  
        5   
    )
RETURN MID(FullString, StartPosition, LEN(FullString) - StartPosition + 1)



 Result:

 

vjialongymsft_0-1729649123957.png

 

 

 

 

Best Regards,

Jayleny

 

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

7 REPLIES 7
Anonymous
Not applicable

Hi @sanjayarun55 

Please try the following calculate column:

ExtractedText = 
VAR FullString = 'Table'[Group]
VAR StartPosition = 
    IF(
        MID(FullString, 5, 1) = "1",
        7,  
        5   
    )
RETURN MID(FullString, StartPosition, LEN(FullString) - StartPosition + 1)



 Result:

 

vjialongymsft_0-1729649123957.png

 

 

 

 

Best Regards,

Jayleny

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

AMAZINGGG. just what i wanted thanks appreciate a lot

ajohnso2
Super User
Super User

ajohnso2_0-1729612839599.png

 

sorry MPIP is not a constant name just the size is always 4 i have updated my original post

in that case try this, if the length of MPIP, SPIP changes in the future you will need to re evaluate this logic.

ajohnso2_0-1729613742307.png

 

Thanks for the effort but doesnt look like this works on direct query. POwer BI is asking me to convert to all tables to import mode

Do you have access to the database your pulling your data from? You can either do the equivalent there or if you are passing SQL as part of your direct query you can format your column there.

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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