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
dsabsi
Advocate I
Advocate I

Need help with a formula to show certain text in a column

 

 Hello gentlemen and ladies, 

 

I need your help with perhaps a simple formula. 

I have text in a column in Power BI Desktop, and I only want to show a certain piece of this text column. 

To simply this, I added the below picture, where I only want to see "Hello". 

I'm aware that I have to create a new column for this but I can't find the formula to accomplish this. 

Need help with a formula.JPG

 Can anyone please help?

 

Thanks in advance. 


Kind regards, 

DSabsi

 

1 ACCEPTED SOLUTION

Hi @dsabsi,


You can try to use below formula:

Search = 
var right_range= "Registratienummer"
var left_range= "Pakketnaam:"
var temp=LEFT([Test],SEARCH(right_range,[Test],,0)-1)
return
RIGHT(temp,LEN(temp)-SEARCH(left_range,temp,,0)-LEN(left_range))

 

8.PNG

 

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

View solution in original post

8 REPLIES 8
v-shex-msft
Community Support
Community Support

Hi @dsabsi,

 

You can try to use below formula to get specific part to text:

 

Display = RIGHT([Text],LEN([Text])-SEARCH(":",[Text],,0)) 

4.PNG

 

 

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

Hello @v-shex-msft@MFelix@Salvador,

 

Many thanks for your replies (this community rocks!)Need help.png

 

HelpfromPowerBIfriends= right(tablename];len(tablename)-search("Pakketnaam";tablename;;0))

 

I tried your formula but it doesn't show me what I want to see... I think we are very close. 

See my attached file, I want to see the line "Pakketnaam ZVW basis, variant natura" from that long text field. 

It's somewhere on the 70th position from the left, and I only want to see that text and not that text behind it.

 

Do you have any idea how we can achieve this in Power BI? 

 

Thanks in advance guys!

 

Cheers

Dsabsi

 

 Hop

 

Hi @dsabsi,


You can try to use below formula:

Search = 
var right_range= "Registratienummer"
var left_range= "Pakketnaam:"
var temp=LEFT([Test],SEARCH(right_range,[Test],,0)-1)
return
RIGHT(temp,LEN(temp)-SEARCH(left_range,temp,,0)-LEN(left_range))

 

8.PNG

 

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

Hello @v-shex-msft , 

 

Many thanks for your swift reply (i'm sorry that I'm just responding, I was off for a few days). 

I tried your formula but I got an error: An argument of function 'Search' has the wrong data type or has an invalid value. 

Do you have an idea of what i'm doing wrong?

 

I added the printscreen in this message (I only removed the column name)

Xiaxoin Sheng.png

Many thanks!!!!

 

CHeers,

 

DSabsi 

 

 

 

Hello @v-shex-msft,

 

If I remove the "]", it won't get the column in my table database. 

I've added a part of my column with only the crucial parts removed, so that you can see where it gets the data from. 

Xiaxoin Sheng.png

 

 I look forward to your solution, it would be great if we can solve this 🙂

 

Cheers, 

Dsabsi

 

 

Hi @dsabsi,

 

I found you left the "]" in the formula, I think the issue is related to it, please modify it to fix the issue.

7.PNG

 

Regards.

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.
MFelix
Super User
Super User

Hi @dsabsi,

 

You need to use a combination between search and left something like this:

 

 

Split = LEFT( Table[Column]; 
           SEARCH(":";Table[Column]; 1; 
               LEN(Table[Column])-1
             )-1
         )

In this formula I'm assuming you want everything from the ":" forward, don't know exactly how you have your information but should work.

 

Regards,

MFelix

 


Regards

Miguel Félix


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

Proud to be a Super User!

Check out my blog: Power BI em Português



Salvador
Responsive Resident
Responsive Resident

Hi,

 

You could use the "left" function, if the text has a constant number of characters, or... there's a post on how to extract the data between special characters, that might be of help. http://community.powerbi.com/t5/Desktop/How-to-extract-the-data-between-special-characters/td-p/1357...

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.