cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
AlexLiang Frequent Visitor
Frequent Visitor

retrieve text/string from cells in excel

Hi everyone,

 

Thanks for your attention. I would like to retrieve several information to made counts of a certain information as for ETL. My question is that how can I write the DAX script to extract text from a certain cell in excel? The following picture is the example, how do I retrieve the red words? 

retrieve text from excel.JPG

 

Really appreciate for your support. Thank you. 🙂

1 ACCEPTED SOLUTION

Accepted Solutions
Community Support Team
Community Support Team

Re: retrieve text/string from cells in excel

@AlexLiang,

 

You may add a calculated column as follows.

Column =
VAR s1 = "3. Defect type:"
VAR s2 = "4. Initiator:"
VAR p1 =
    SEARCH ( s1, Table1[Abnormal Description] )
VAR p2 =
    SEARCH ( s2, Table1[Abnormal Description], p1 )
RETURN
    MID ( Table1[Abnormal Description], p1 + LEN ( s1 ), p2 - p1 - LEN ( s1 ) )
Community Support Team _ Sam Zha
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

6 REPLIES 6

Re: retrieve text/string from cells in excel

Hi @AlexLiang

 

This is a rough approach but you could introduce calculated columns to detect it using DAX

 

something like

 

 

Column contains Crack = 
IF( FIND( "Crack", 'Table1'[Column3], 1, blank() ) > 0 , TRUE(), FALSE())

 


To learn more about DAX visit : aka.ms/practicalDAX

Proud to be a Datanaut!

AlexLiang Frequent Visitor
Frequent Visitor

Re: retrieve text/string from cells in excel

Hi @Phil_Seamark

 

Thanks for your feedback.

What if I want to retrieve all kinds of "defect type" and put them in a new column?

Because I may need to calculate the frequency of each defect type.

Thank you again. 🙂

 

 

Re: retrieve text/string from cells in excel

Do you have a predefined list of defects?  Do you need to maintain a separate count for each type?


To learn more about DAX visit : aka.ms/practicalDAX

Proud to be a Datanaut!

AlexLiang Frequent Visitor
Frequent Visitor

Re: retrieve text/string from cells in excel

I think we have the predefined list of defect. The separate count for each type is the column that I want to input to powerBI for visualization. I am not sure if it's the same meaning as maintain, thank you.

Community Support Team
Community Support Team

Re: retrieve text/string from cells in excel

@AlexLiang,

 

You may add a calculated column as follows.

Column =
VAR s1 = "3. Defect type:"
VAR s2 = "4. Initiator:"
VAR p1 =
    SEARCH ( s1, Table1[Abnormal Description] )
VAR p2 =
    SEARCH ( s2, Table1[Abnormal Description], p1 )
RETURN
    MID ( Table1[Abnormal Description], p1 + LEN ( s1 ), p2 - p1 - LEN ( s1 ) )
Community Support Team _ Sam Zha
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

AlexLiang Frequent Visitor
Frequent Visitor

Re: retrieve text/string from cells in excel

Hi @v-chuncz-msft

 

Really appreciate for your kindly support.

Thank you 🙂

 

Helpful resources

Announcements
New Topics Started Badges Coming

New Topics Started Badges Coming

We're releasing new versions of the badge that everyone's talking about. ;) Check your inbox for notifications.

MBAS 2020

Save the new date (and location)!

Our business applications community is growing—so we needed a different venue, resulting in a new date and location. See you there!

Difinity Conference

Difinity Conference

The largest Power BI, Power Platform, and Data conference in New Zealand

Top Solution Authors
Top Kudoed Authors (Last 30 Days)