Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
anushkavp27
Frequent Visitor

Extracting a particular text from column in a particular format

Hi 

 

I have a column that descibes a part. 

It is of format: SSDR,480G,2A,IT276,27.8,EXAMP,LU

I am particularly interested in obtaining the size which is 480G.

 

The problem is that there are other variants in this:

Example: SSDR,3.8T,2A,IT27,8.9,X,99,AA (in thsi example, I want to extract 3.8T) 

SSDR,NMMVV,3.84T,X.2,EXAMPL(in this particualr example, the size i want = 3.84T is the 3rd parameter in the split string)

SSDR,1.6TB,NMMVV,X.2,XX1 (in this example, I want 1.6TB)

 

 

The other problem that arises is that this column doesn't have all values starting with SSDR.

We have values like this ARRY,ABC,ABCDE22,EXL,X99,T500 but since this does not start with SSDR, we can leave this blank in the new column we create.

4 REPLIES 4
ExcelMonke
Responsive Resident
Responsive Resident

If your intended result is always after the first "delimiter" (i.e. after the first comma) then you can consider using a combination of the LEFT and FIND functions. However, if it is randomly located, it might be difficult to write a logical formula unless you want to make it a bit more complex; e.g. something that will allow the logic to pull "return value after first delimiter and if value after delimiter is NMMVV"

Greg_Deckler
Super User
Super User

@anushkavp27 This will get you the cases you've specified except having the size in the 3rd parameter. If you have a list of codes you need to search for you could modify this to take that into account.

Column = 
    IF( 
        LEFT([Value], 5) <> "SSDR,",
        BLANK(),
            VAR __NextComma = FIND(",", [Value], 6, -1)
            VAR __Result = IF( __NextComma = -1, BLANK(), MID([Value], 6, __NextComma - 5 - 1) )
        RETURN
            __Result
    )

Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

Thank you for your response. I really appreciate it.

 

However, I also need to take care of the other cases, where the size is after the second comma in the string and they are a lot in number and hence, I have to account for them. And that is what makes this so complex 🙂 

AUDISU
Resolver III
Resolver III

Hi @anushkavp27 ,

We need a common factor to identify the size. As an example, Starting with a letter or end with a letter or always in a specific location.
Did you notice any common factor for size in your dataset?
Thanks

Helpful resources

Announcements
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel1

Power BI Monthly Update - May 2024

Check out the May 2024 Power BI update to learn about new features.