Forum Discussion
Conditonal Statement
- 4 years ago
Insert a Custom column and paste following (Add column menu - Custom column)
= [USD Amount]??[Invoice Amount]
You can also put following formula as an alternative
= if [USD Amount]=null then [Invoice Amount] else [USD Amount]
As an alternative, you can use coalescing operator. Hence, use following
= [USD Amount]??[Invoice Amount]
See the working here - Open a blank query - Home - Advanced Editor - Remove everything from there and paste the below code to test
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMjRV0lFSitWJVgLSRgYwFpg2NgCyjI2UYmMB", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [#"USD Amount" = _t, #"Invoice Amount" = _t]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"USD Amount", Int64.Type}, {"Invoice Amount", Int64.Type}}),
#"Added Custom" = Table.AddColumn(#"Changed Type", "Result", each [USD Amount]??[Invoice Amount])
in
#"Added Custom"Note: I am using Power Query not Power BI.
- Vijay_A_Verma4 years ago
Most Valuable Professional
Insert a Custom column and paste following (Add column menu - Custom column)
= [USD Amount]??[Invoice Amount]
You can also put following formula as an alternative
= if [USD Amount]=null then [Invoice Amount] else [USD Amount]
- Centaur4 years ago
Helper V
Adding a Custom Column worked. I note that if I add a Conditional Column the word null must be lower case.
here is what I used:
= if [USD Amount]=null then [Invoice Amount] else [USD Amount]
I discovered its CASE SENSITIVE, which is annoying.
thank you very much for the help.