Starting December 3, join live sessions with database experts and the Microsoft product team to learn just how easy it is to get started
Learn moreGet certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now
Hi There,
I want to add a new conditional column in Power Query with the name "Status". For all the vendors that have **D** in their name should have the status delisted and the rest will have the status live. I am not able to search based on **D** as it's returning all the values. Please advise.
Thank You.
Solved! Go to Solution.
Hi @sustar2020 ,
Add a custom column:
Code for the step:
Replace blue text with the previous step.
1. Table.AddColumn(Data0, "Status", each if Text.Contains([Column1],"**D**") then "Delisted" else "Live")
if for some reason 1 does not work, then add Text.From(). See 2
2.Table.AddColumn(Data0, "Status", each if Text.Contains(Text.From([Column1]),"**D**") then "Delisted" else "Live")
Hi @sustar2020 ,
Add a custom column:
Code for the step:
Replace blue text with the previous step.
1. Table.AddColumn(Data0, "Status", each if Text.Contains([Column1],"**D**") then "Delisted" else "Live")
if for some reason 1 does not work, then add Text.From(). See 2
2.Table.AddColumn(Data0, "Status", each if Text.Contains(Text.From([Column1]),"**D**") then "Delisted" else "Live")
I want the desired output as:
Vendor Name Status
ABC**D** ltd (GB) | Delisted |
ABC Food Ltd (GB) | Live |
Thames Valley **D** (GB) | Delisted |
Wild Harvest Ltd (GB) | Live |
Wild Harvesters Ltd**D** (GB) | Delisted |
Hi Greg,
Thank you for the reply.
I tried this already. Its not working. It is showing all the vendors as 'live' as it's taking '*' as a wild card search and not as a string literal.
This works
If this doesn't work can you share a screenshot of the code and table?
That would help troubleshoot your issue.
Hi There,
"**D**" didn't work in a conditional column like the way you said. However when I looked to check the postion of "**D**" in a Custom Column it worked. Not sure why?
Here's the code below that I have used:
Thank you very much for your help.
Cheers
@sustar2020 Add a conditional column:
Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.
User | Count |
---|---|
24 | |
13 | |
12 | |
11 | |
8 |
User | Count |
---|---|
42 | |
26 | |
14 | |
14 | |
12 |