Forum Discussion
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
Hi sd_kevin
Try this function COALESCE().
e.g.
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.
3 Replies
- v-xiaotangCommunity Support
Hi sd_kevin
Try this function COALESCE().
e.g.
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.
- sd_kevinAdvocate II
Thank you!! That was exactly what I was looking for!!
- HotChilliCommunity Champion
Do you mean the ?? operator?