COZYHUB
  • Home
  • Disclaimer
  • Privacy Policy
  • About
  • Contact

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_csteve smith steve smithnull james jamessally 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?

1

Best Answer


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

if [col_a] = null or [col_b] = nullthen nullelse [col_a] & " " & [col_b]

Random Posts

How to simulate a click with JavaScript?Why and how (internally) does Enum.IsDefined search for both name and value?Can I convert HL7 v2 message to a FHIR resource directly? [duplicate]How to compute an average runtime?How to use 'seq' function in R to get odd and even numbers? [duplicate]Suggestion for template book for C++? [closed]Turning a Matrix into a VectorInstall ipdb for Python 3? [duplicate]Bash get last line from a variableHow do you build all of LLVM?From ... In ... Select in C#Pair/tuple data type in Goe.target.value on an input field ReactJs, how does it work?Why is `null + 1 = 1` but `undefined + 1 = NaN`?How to convert a double to an int in Dart?C# - Rounding Down to Nearest IntegerReplace multiple values with jinja2Install webdeploy on W2016 IIS 10DTO vs. Domain Model, project organizationCannot get a QT "hello world" to work!
Designed by COZYHUB