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
reetu_k
Employee
Employee

Split Columns using delimiter in direct query mode

I have a direct query and have the need to split my column using a delimiter like '_'. Since I am in the direct query mode I am not able to use the split column option. I want a new column with data from the left of the delimiter.

 

Here is what my data looks like the following:

 

Answer1_Right1

Answer2_Right2

123_Right3

4 REPLIES 4
Greg_Deckler
Super User
Super User

Pretty sure direct query does not allow that. You would have to switch to import/composite mode.


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...
Mariusz
Community Champion
Community Champion

Hi @reetu_k 

 

Try this, but not sure if it will work in Direct Query Mode

Measure = 
VAR __text = SELECTEDVALUE( 'Table'[Column1] )
RETURN 
    LEFT( 
        __text, 
        SEARCH( "_", __text, 1, 1 ) -1 
    )

 

Best Regards,
Mariusz

If this post helps, then please consider Accepting it as the solution.

Please feel free to connect with me.
LinkedIn

 

Hi 

 

Unfortunately this did not work for me as Search returns the position of the '_' from the string - So I am getting a numerical response back

dax
Community Support
Community Support

Hi @reetu_k , 

As I know, find and search can't used in calculated column when you using direct query, so I think you could try to use t-sql query to create the split column when you use direct query.

Best Regards,
Zoe Zhi

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

 

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