cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
WJ876400 Helper II
Helper II

Split numbers from longer text

Hi

 

How do i just take out the percentage from the list below in column 1. Thanks

 

Capture.PNG

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Community Support
Community Support

Re: Split numbers from longer text

@WJ876400 ,

 

Just modify the dax above:

Column = 
VAR v_PercentPos = SEARCH( "%", 'Table'[Data], 1, 0 )
VAR _var = TRIM( RIGHT( LEFT( 'Table'[Data], v_PercentPos ), 3 ) )
RETURN
IF(_var = "00%", "100%", _var)

Or another way is to use python script:

# 'dataset' holds the input data for this script

import pandas as pd

dataset['Result'] = dataset['Data'].str.extract('\s(100%|(\d{1,2}(\.\d+)*)%)')[0]

Capture.PNG 

 

Community Support Team _ Jimmy Tao

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

4 REPLIES 4
vaibhavdesai Solution Supplier
Solution Supplier

Re: Split numbers from longer text

Hi @WJ876400 ,

Try this:

Column = 
VAR v_PercentPos = SEARCH( "%", 'Table'[Field], 1, 0 )
RETURN
TRIM( RIGHT( LEFT( 'Table'[Field], v_PercentPos ), 4 ) )

result.PNG

Thanks.

Please accept this as a solution if it satisfies the requirement. Appreciate your Kudos. 🙂

WJ876400 Helper II
Helper II

Re: Split numbers from longer text

Hi @vaibhavdesai 

 

Thanks that worked apart from two rows i have ended up with an e and an m infront of the number

 

Capture1.PNGCapture2.PNG

Community Support
Community Support

Re: Split numbers from longer text

@WJ876400 ,

 

Just modify the dax above:

Column = 
VAR v_PercentPos = SEARCH( "%", 'Table'[Data], 1, 0 )
VAR _var = TRIM( RIGHT( LEFT( 'Table'[Data], v_PercentPos ), 3 ) )
RETURN
IF(_var = "00%", "100%", _var)

Or another way is to use python script:

# 'dataset' holds the input data for this script

import pandas as pd

dataset['Result'] = dataset['Data'].str.extract('\s(100%|(\d{1,2}(\.\d+)*)%)')[0]

Capture.PNG 

 

Community Support Team _ Jimmy Tao

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

WJ876400 Helper II
Helper II

Re: Split numbers from longer text

@vaibhavdesai  @v-yuta-msft  thanks for your help

Helpful resources

Announcements
New Ranks Launched March 24th!

New Ranks Launched March 24th!

The time has come: We are finally able to share more details on the brand-new ranks coming to the Power BI Community!

‘Better Together’ Contest Finalists Announced!

‘Better Together’ Contest Finalists Announced!

Congrats to the finalists of our ‘Better Together’-themed T-shirt design contest! Click for the top entries.

Arun 'Triple A' Event Video, Q&A, and Slides

Arun 'Triple A' Event Video, Q&A, and Slides

Missed the Arun 'Triple A' event or want to revisit it? We've got you covered! Check out the video, Q&A, and slides now.

Join THE global Microsoft Power Platform event series.

Join THE global Power Platform event series.

Attend for two days of expert-led learning and innovation on topics like AI and Analytics, powered by Dynamic Communities.

Community Summit North America

Community Summit North America

Innovate, Collaborate, Grow. The top training and networking event across the globe for Microsoft Business Applications

Top Solution Authors
Top Kudoed Authors