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

Learn from the best! Meet the four finalists headed to the FINALS of the Power BI Dataviz World Championships! Register now

Reply
jereaallikko
Helper III
Helper III

How to simplify a column text

Hi all,

 

I'm having a slight problem with organizing a messy data table, in Power BI Query. An example table shown below.

 

Untitled.jpg

 

 

 

 

 

 

 

 

 

 

 

 

 

What I'm trying to do (preferably in Power BI Query), is to modify data in the Description column, to indicate clearly only the status percentage.

 

For example like this:

 

Description

Status: 30%

Status: 80%

Status: 20%

Status: 0%

Status: 100%

Status: 85%

Status: Unknown/?/null

Status: 10%

Status: ?/Unknown/null

Status: 0%

 

Can also be without colons (:) or percentage marks (%)

 

Can someone provide me step-by-step instructions, if it is possible?

 

Thanks

 

Jere

1 ACCEPTED SOLUTION
Smauro
Solution Sage
Solution Sage

Hi @jereaallikko 

 

You could try adding in a function with the transformations, and transforming your column with it:

 

 

    StatFinder = (t1 as text) =>
        let
            t = Text.Replace(Text.Lower(t1), ":", " "),
            s1 = Text.AfterDelimiter(t, "status"),
            n1 =
                if s1 <> ""
                    then    
                        let t2 = Text.BeforeDelimiter(s1, "%"),
                            t3 = try Number.From(t2) otherwise try Number.From(Text.BeforeDelimiter(Text.AfterDelimiter(Text.Trim(s1), " "), " ")) otherwise null
                        in Text.From(t3)
                    else null,
            res = if n1 = null then "Status: Unknown" else Text.Trim("Status: " & n1 & "%")
        in
            res,
    FindStatus = Table.TransformColumns(PreviousStep,{{"Description",  StatFinder, type text}})

 

 

 (PreviousStep should be your last step)

 

Cheers,




Spyros Mavroforos

Data Consultant


Find me on LinkedIn or drop me an email

eSpyros

View solution in original post

3 REPLIES 3
mahoneypat
Microsoft Employee
Microsoft Employee

You can add a Custom Column with an expression like this

 

= "Status: " & Text.Select(Text.BetweenDelimiters([Description], "Status", "%"), {"0".."9"}) & "%"

 

If this works for you, please mark it as the solution.  Kudos are appreciated too.  Please let me know if not.

Regards,

Pat





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


Pragati11
Super User
Super User

Hi @jereaallikko ,

 

You can try using EXTRACT feature in query editor as follows:

textdel.png

 

There are multiple options in there. In your case you can try using "Text Between Delimiters" option.

 

Thanks,

Pragati

Best Regards,

Pragati Jain


MVP logo


LinkedIn | Twitter | Blog YouTube 

Did I answer your question? Mark my post as a solution! This will help others on the forum!

Appreciate your Kudos!!

Proud to be a Super User!!

Smauro
Solution Sage
Solution Sage

Hi @jereaallikko 

 

You could try adding in a function with the transformations, and transforming your column with it:

 

 

    StatFinder = (t1 as text) =>
        let
            t = Text.Replace(Text.Lower(t1), ":", " "),
            s1 = Text.AfterDelimiter(t, "status"),
            n1 =
                if s1 <> ""
                    then    
                        let t2 = Text.BeforeDelimiter(s1, "%"),
                            t3 = try Number.From(t2) otherwise try Number.From(Text.BeforeDelimiter(Text.AfterDelimiter(Text.Trim(s1), " "), " ")) otherwise null
                        in Text.From(t3)
                    else null,
            res = if n1 = null then "Status: Unknown" else Text.Trim("Status: " & n1 & "%")
        in
            res,
    FindStatus = Table.TransformColumns(PreviousStep,{{"Description",  StatFinder, type text}})

 

 

 (PreviousStep should be your last step)

 

Cheers,




Spyros Mavroforos

Data Consultant


Find me on LinkedIn or drop me an email

eSpyros

Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.