Record.FieldOrDefault

 

This topic applies to the Power Query Formula Language which can be used with Power Query and Power BI Desktop to build queries that mashup data. See the list of function categories.

Returns the value of a field from a record, or the default value if the field does not exist.

Record.FieldOrDefault(record as record, field as text, optional defaultValue as any) as any  

ArgumentDescription
recordThe Record to check.
fieldThe field to return.
optional defaultValueThe default value to return if the field does not exist.
Record.FieldOrDefault([CustomerID =1, Name="Bob"], "Phone") equals null  

Record.FieldOrDefault([CustomerID =1, Name="Bob"], "Phone", "123-4567") equals "123-4567"  

Show: