Forum Discussion

TG_12's avatar
TG_12
Frequent Visitor
4 years ago
Solved

Return value depending on value contained in text

Hi all,    I have a column where some entries contain the values ML1, ML2, ML3, ML4 or ML5 at the start of the text. I am looking to add a column in my table that returns "ML#"  depending on what M...
  • HotChilli's avatar
    4 years ago

    Is the ML always going to be at the start?

    If so, create a column in Power Query using an if statement with Text.StartsWith() to look for "ML" and then retrieve the first 3 chars using Text.Start() (if it doesn't start with ML, make it "")

    --

    In the table visual, filter out the empty 'ML Category' values from the filter pane.  And sorting by 2 columns can be done using the shift key clicking on the column header.