Power BI - Power Query Case Statement

Is there a way to do a case statement inside of Power BI, specifically written in M?

I have columns that look like this:

col_a     col_b      col_c
steve     smith      steve smith
null      james      james
sally     null       sally

Col_c is a concatenation of columns a and b. If column a or b are null, then I want column c to be null, no matter what.

Any suggestions?

Upvotes: 1

Views: 8211

Answers (1)

Alexis Olson
Alexis Olson

Reputation: 40244

M has a fairly standard if, then, else syntax.

if [col_a] = null or [col_b] = null
then null
else [col_a] & " " & [col_b]

Upvotes: 1

Related Questions