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

A new Data Days event is coming soon! This time we’re going bigger than ever. Fabric, Power BI, SQL, AI and more. Don't miss out.

Reply
sd_kevin
Advocate II
Advocate II

Power Query Function That Returns Value Based on Which Columns Have Data

Hi,

 

In the past I came across a function that would return a value from either Column A, B, C, or D depending if which ones contain data. 

 

For example:

 

Col A = USA

Col B = CA

Col C = San Diego County

Col D = San Diego

 

The function would return the value in Col D, but if no value in Col D, it would look in Col C and if it had a value it would return that.  If both columns C & D don't have values, it would look in Col B, etc..

 

I know I can accomplish this with an IF statement but I remember seeing a function that handles this. Hoping someone knows the function I am referring to.

 

Thank you!

 

Kevin

1 ACCEPTED SOLUTION
v-xiaotang
Community Support
Community Support

Hi @sd_kevin 

Try this function COALESCE().

e.g.

v-xiaotang_1-1621322657717.png

FYI: https://dax.guide/coalesce/

 

Best Regards,

Community Support Team _ Tang

If this post helps, please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

3 REPLIES 3
v-xiaotang
Community Support
Community Support

Hi @sd_kevin 

Try this function COALESCE().

e.g.

v-xiaotang_1-1621322657717.png

FYI: https://dax.guide/coalesce/

 

Best Regards,

Community Support Team _ Tang

If this post helps, please consider Accept it as the solution to help the other members find it more quickly.

Thank you!! That was exactly what I was looking for!!

HotChilli
Community Champion
Community Champion

Do you mean the ?? operator?

Helpful resources

Announcements
May Power BI Update Carousel

Power BI Monthly Update - May 2026

Check out the May 2026 Power BI update to learn about new features.

Fabric SQL PBI Data Days

Data Days 2026 coming soon!

Sign up to receive a private message when registration opens and key events begin.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.