Daniel Garner
Daniel Garner

Reputation: 1

Add a conditional column in Power BI Power Query

I am trying to add a conditional column in Power BI Power Query. I have three columns with values. If all three columns return a value, then the conditional column should return true. If any column returns a null value, then I want the conditional column to return false. Newbie here and I just cannot figure it out. Any help is appreciated.

Upvotes: 0

Views: 3425

Answers (2)

ALeXceL
ALeXceL

Reputation: 651

Just another way to do it (Power Query M)

'Source' is the name of the previous step and you have to adapt it when inserting it. 'Column1', 'Column2' and 'Column3' are the column names you also have to adapt.

 = Table.AddColumn(Source, "AllColumnsWithData", each if List.AllTrue({[Column1]<>null,[Column2]<>null,[Column3]<>null}) then true  else false)

enter image description here

Upvotes: 0

horseyride
horseyride

Reputation: 21393

In M, add a custom column

= if [columnname1]=null or [columnname2]=null or [columnname3]=null then false else true

that assumes they are real nulls, instead of blank strings, which might require =""

Upvotes: 1

Related Questions