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

Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM. Register now.

Reply
arb1782
Helper III
Helper III

Need help with custom column formula in PowerQuery

Hi

 

I have a table that's built by referencing another table. Within the second table I need to create a custom column ith the following logic

 

If column X = 'xyz', then "yes"

If column Y = 'xyz', then "yes"

Otherwise "no"

 

I wrote the formula in DAX but the custom column function in PowerQuery appears to use a different language. Could anyone please help?

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @arb1782 ,

You could use the following syntax in "Add a custom column" window.

each if [X]="xyz" then "Yes" else if [Y]="xyz" then "Yes" else "No"

9.22.3.1.png

9.22.3.2.PNG

Did I answer your question ? Please mark my reply as solution. Thank you very much.
If not, please upload some insensitive data samples and expected output.

 

Best Regards,
Eyelyn Qin

View solution in original post

6 REPLIES 6
Anonymous
Not applicable

Hi @arb1782 ,

You could use the following syntax in "Add a custom column" window.

each if [X]="xyz" then "Yes" else if [Y]="xyz" then "Yes" else "No"

9.22.3.1.png

9.22.3.2.PNG

Did I answer your question ? Please mark my reply as solution. Thank you very much.
If not, please upload some insensitive data samples and expected output.

 

Best Regards,
Eyelyn Qin

Thanks all

PaulDBrown
Community Champion
Community Champion

@arb1782 

 

Use the Option in the ribbon to add a new conditional column and write the logic in the interface. You can select different columns.

For example:

PQ Condit Col.JPG

 





Did I answer your question? Mark my post as a solution!
In doing so, you are also helping me. Thank you!

Proud to be a Super User!
Paul on Linkedin.






Ah, I didn't spot that before, thanks! I've set it up as is following:

 

If column x CONTAINS 'xyz' then yes

OR if column y is equal to 'xyz' then yes

Otherwise No

 

Mhy remaining problem is that when column x is null, PBI returns error instead of No. Any ideas how to rectify this? There doesn't appear to be 'isnull' in the available criteria.

Any further thoughts on my reply @PaulDBrown 

amitchandak
Super User
Super User

@arb1782 , Can you share sample data and sample output in table format? Or a sample pbix after removing sensitive data.

 

Can you see if this can help:https://eriksvensen.wordpress.com/2019/02/28/powerquery-replicate-doing-an-excel-vlookup-in-m/

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.