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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
kelvin-lkhca
Helper I
Helper I

Set a Custom Column to retrieve from the Correct column

Hi All Gurus,

 

Below are the two columns in my power query table. I wish to create a new column with the logic that if Col Period - Copy is not error, then it will take the value from Period - Copy, otherwise, it will take from column Period.

 

I have tried the custom column but the logic I know of doesn't work. Hope that I can find the solution here.

 

 

kelvinlkhca_0-1688170262647.png

 

1 ACCEPTED SOLUTION
tackytechtom
Super User
Super User

Hi @kelvin-lkhca ,

 

How about this:

tackytechtom_0-1688174179015.png

 

 

The Power Query M syntax for the custom column is:

try [#"Period - Copy"] otherwise [Period]

 

Let me know if this helps 🙂

 

/Tom
https://www.tackytech.blog/
https://www.instagram.com/tackytechtom/



Did I answer your question➡️ Please, mark my post as a solution ✔️

Also happily accepting Kudos 🙂

Feel free to connect with me on LinkedIn! linkedIn

#proudtobeasuperuser 

View solution in original post

2 REPLIES 2
tackytechtom
Super User
Super User

Hi @kelvin-lkhca ,

 

How about this:

tackytechtom_0-1688174179015.png

 

 

The Power Query M syntax for the custom column is:

try [#"Period - Copy"] otherwise [Period]

 

Let me know if this helps 🙂

 

/Tom
https://www.tackytech.blog/
https://www.instagram.com/tackytechtom/



Did I answer your question➡️ Please, mark my post as a solution ✔️

Also happily accepting Kudos 🙂

Feel free to connect with me on LinkedIn! linkedIn

#proudtobeasuperuser 

It works perfectly. I am so impressed by this formula which I had never come accross before.

 

Thank a lot!

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.

Top Solution Authors