Forum Discussion
WJ876400
6 years agoHelper IV
Split numbers from longer text
Hi How do i just take out the percentage from the list below in column 1. Thanks
- 6 years ago
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]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.
v-yuta-msft
6 years agoCommunity Support
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]
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.
WJ876400
6 years agoHelper IV
Anonymous v-yuta-msft thanks for your help