cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
haykp
Helper I
Helper I

How to get the word between 2 underscores

Dear Power Bi Community,

 

Please help me with my first steps in DAX.

So I have a file name which has different words all connected with underscores ("_"). Somehting like this:

sales1_germany_tests_lcd_2023_W17

How I can parse and get each of the words in seperate column. In other words, what I need is some DAX expression which can return me the Word between the "_" symbol:  i.e. _<Word>_

and my final result should be

sales1  

germany

tests

lcd

2023

W17

 

Can someone please share some hints about DAX?

 

Thanks

Hayk

1 ACCEPTED SOLUTION
tackytechtom
Super User
Super User

Hi @haykp ,

 

Before

 

Power Query is perfect for what you would like to achieve!

 

Before:

tackytechtom_1-1684778661971.png

 

After:

tackytechtom_2-1684778693911.png

 

 

 

Here how to do it:

tackytechtom_0-1684778600482.png

 

If you really want to use DAX for this, consider the following blog post:

Power BI Split Column By Delimiters In DAX (enterprisedna.co)

 

Let me know if this helps 🙂

 

/Tom
https://www.tackytech.blog/
https://www.instagram.com/tackytechtom/

 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




View solution in original post

3 REPLIES 3
tackytechtom
Super User
Super User

Hi @haykp ,

 

Glad to hear! Just copy the column that you wanna keep before you do the split. You can do this by adding a new column and just refer to the original one.

 

let me know if this helps 🙂

 

/Tom
https://www.tackytech.blog/
https://www.instagram.com/tackytechtom/





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




tackytechtom
Super User
Super User

Hi @haykp ,

 

Before

 

Power Query is perfect for what you would like to achieve!

 

Before:

tackytechtom_1-1684778661971.png

 

After:

tackytechtom_2-1684778693911.png

 

 

 

Here how to do it:

tackytechtom_0-1684778600482.png

 

If you really want to use DAX for this, consider the following blog post:

Power BI Split Column By Delimiters In DAX (enterprisedna.co)

 

Let me know if this helps 🙂

 

/Tom
https://www.tackytech.blog/
https://www.instagram.com/tackytechtom/

 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Thank you!

This solution is very good. 

Just one issue, after split the inital column is lost. Can I keep it?

 

Thanks

Hayk

Helpful resources

Announcements
PBI Sept Update Carousel

Power BI September 2023 Update

Take a look at the September 2023 Power BI update to learn more.

Learn Live

Learn Live: Event Series

Join Microsoft Reactor and learn from developers.

Dashboard in a day with date

Exclusive opportunity for Women!

Join us for a free, hands-on Microsoft workshop led by women trainers for women where you will learn how to build a Dashboard in a Day!

MPPC 2023 PBI Carousel

Power Platform Conference-Power BI and Fabric Sessions

Join us Oct 1 - 6 in Las Vegas for the Microsoft Power Platform Conference.

Top Solution Authors
Top Kudoed Authors