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

The Fabric community is upgrading! Read all of the details including the timeline and what you can expect. Learn more

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
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

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.