Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM. Register now.

Reply
Centaur
Helper V
Helper V

Conditonal Statement

Hello, I am a novice user. 

I have 2 fields: 

Invoice Amount

USD Amount

 

If USD Amount is Null then I want to show Invoice Amount otherwise, show the USD Amount. 

I think this is a conditional field but I am not sure how to enter it. 

If could kindly assist.  

Let me know if you need anything else. 

 

thank you. 

 

 

 

1 ACCEPTED SOLUTION

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]

1.png

1.png

View solution in original post

11 REPLIES 11
Vijay_A_Verma
Super User
Super User

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.   

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]

1.png

1.png

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.  

Hi Vijay, that seemed to work.  How could I use that solution though?  I was hoping for something simpler (ie adding a conditional column).  Sorry but my experience with power query is very basic.  

here is the output of the blank query: 

Centaur_1-1657191526088.png

 

otravers
Community Champion
Community Champion

equals operator followed by "null" (without quotes) as value should do it.

------------------------------------------------
1. How to get your question answered quickly - good questions get good answers!
2. Learning how to fish > being spoon-fed without active thinking.
3. Please accept as a solution posts that resolve your questions.
------------------------------------------------
BI Blog: Datamarts | RLS/OLS | Dev Tools | Languages | Aggregations | XMLA/APIs | Field Parameters | Custom Visuals

Otravers,

I had actually tried prior to posting this question but apparently you cant enter a value of NULL.  It must be a value.  Any other suggestions adding a Conditional Column? 

 

Centaur_0-1657191154452.png

 

otravers
Community Champion
Community Champion

The M language in Power Query is case sensitive, I wrote "null" (not "NULL") for a reason and what I suggested works as demonstrated here:

otravers_0-1657194575261.png

------------------------------------------------
1. How to get your question answered quickly - good questions get good answers!
2. Learning how to fish > being spoon-fed without active thinking.
3. Please accept as a solution posts that resolve your questions.
------------------------------------------------
BI Blog: Datamarts | RLS/OLS | Dev Tools | Languages | Aggregations | XMLA/APIs | Field Parameters | Custom Visuals

ahh I see now.  Its case sensitive.   I confirm I do not get an error but I do if any letter is capitalized.  Geez that is annoying.  

 

Centaur_0-1657196384014.png

 

otravers
Community Champion
Community Champion

You can do so from the Power Query UI as explained here:

https://docs.microsoft.com/en-us/power-query/add-conditional-column

------------------------------------------------
1. How to get your question answered quickly - good questions get good answers!
2. Learning how to fish > being spoon-fed without active thinking.
3. Please accept as a solution posts that resolve your questions.
------------------------------------------------
BI Blog: Datamarts | RLS/OLS | Dev Tools | Languages | Aggregations | XMLA/APIs | Field Parameters | Custom Visuals

Hi, thank you.  I am familiar with at least that much of it but my problem is how do I add a condition as NULL?  The value in the table is NULL and I don't see NULL as being one of the operators.  Thank you 

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Kudoed Authors