Microsoft Fabric Community Conference 2025, March 31 - April 2, Las Vegas, Nevada. Use code FABINSIDER for a $400 discount.
Register nowThe Power BI DataViz World Championships are on! With four chances to enter, you could win a spot in the LIVE Grand Finale in Las Vegas. Show off your skills.
Hi all,
I have a column containing Priorities 1-4 in the format P1,P2 etc. which I'd like to isolate/extract.
However, within the column, the entire string appears in various forms as seen below. I have attempted to use an if formula which has worked in extracting the 'P1' 'P2' format. However, how can I extract the 'Px' from the bottom format (TCS (SAP) etc.) THANKS!
SLA Definition
P4 - Incident
P2 - Incident
P1 - Incident
TCS (SAP) Resolve P4 SLA - Incident
etc.
Solved! Go to Solution.
Yes, it is Power BI, more specifically Power Query, accessible via "Edit Queries".
Even simplified further:
let Source = Table1, #"Added Custom" = Table.AddColumn(Source, "Priority", (This) => List.SingleOrDefault(List.Select({"P1","P2", "P3", "P4"}, each Text.Contains(This[SLA Definition],_)),"")) in #"Added Custom"
If the priority is always followed by a <blank>, this will work:
let Source = Table1, #"Added Custom" = Table.AddColumn(Source, "Priority", (This) => Text.Start(List.SingleOrDefault(List.Select({"P1 ","P2 ", "P3 ", "P4 "}, each Text.PositionOf(This[SLA Definition],_)>=0),""),2)) in #"Added Custom"
List.SingleOrDefault generates an error if >1 priority was found and it will return "" if no priority was found.
Edit: or even better:
let Source = Table1, #"Added Custom" = Table.AddColumn(Source, "Priority", (This) => Text.Start(List.SingleOrDefault(List.Select({"P1 ","P2 ", "P3 ", "P4 "}, each Text.Contains(This[SLA Definition],_)),""),2)) in #"Added Custom"
Yes, it is Power BI, more specifically Power Query, accessible via "Edit Queries".
Even simplified further:
let Source = Table1, #"Added Custom" = Table.AddColumn(Source, "Priority", (This) => List.SingleOrDefault(List.Select({"P1","P2", "P3", "P4"}, each Text.Contains(This[SLA Definition],_)),"")) in #"Added Custom"
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Check out the February 2025 Power BI update to learn about new features.
User | Count |
---|---|
86 | |
79 | |
53 | |
39 | |
39 |
User | Count |
---|---|
104 | |
85 | |
47 | |
44 | |
43 |