Forum Discussion
Anonymous
6 years agoNot applicable
Extracting a number from Text
Hi everyone :), I have a column with texts such as " XXXX P10000 7FFFF" , "1BCD R150000" would you please help me to find a formula to extract the 10000 and 150000 after the P and R. They are always either P or R as the begining. Thanks alot.
Column = VAR __P = FIND("P",[Column1],,BLANK()) VAR __R = FIND("R",[Column1],,BLANK()) VAR __Start = IF(ISBLANK(__P),__R,__P) + 1 VAR __End = FIND(" ",[Column1],__Start,LEN([Column1])) RETURN MID([Column1],__Start,__End - __Start)
2 Replies
- Greg_Deckler
Community Champion
Column = VAR __P = FIND("P",[Column1],,BLANK()) VAR __R = FIND("R",[Column1],,BLANK()) VAR __Start = IF(ISBLANK(__P),__R,__P) + 1 VAR __End = FIND(" ",[Column1],__Start,LEN([Column1])) RETURN MID([Column1],__Start,__End - __Start) - AnonymousNot applicablePlease do not do this in DAX as it's not a language to shape data and its power to analyze strings is very limited. Such things belong to the data preparation phase and should be performed in Power Query or in the data source.
DAX is a Data Analysis eXpressions language. Not a data mashup engine.
Best
D