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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
rohitjmd
Helper II
Helper II

IF statement in custom column

hello, 

 

i am trying to add a custom column where if value in column A is greater than 0 then column A value should appear, if not value from column B should appear, though if both column have null then null should appear in custom column. i tried to do this with custom and conditional column method but error appers in some rows in both method. please suggest.

 

AB
nullnull
nullnull
nullnull
0null
nullnull
0null
null0
null5.94
7.75null
7.75null
3.93null
4.12null
4.12null
3.98null
4.2null
8.5null
nullnull
nullnull
4.2null
1 ACCEPTED SOLUTION
PattemManohar
Community Champion
Community Champion

@rohitjmd  Try this as a "Custom Column" in Power Query Editor

 

=if [A]=null or [A]<=0 then [B] else [A]

image.png





Did I answer your question? Mark my post as a solution!

Proud to be a PBI Community Champion




View solution in original post

2 REPLIES 2
cooksteve09
Frequent Visitor

What if the column headers change each day? my problem is very similar, i have a date column which then i pivot so the dates become the column headers and i am after a custom column that looks at the previous day and returns those values if greater then the day before else show 0....any help would be greatly appreciate!

PattemManohar
Community Champion
Community Champion

@rohitjmd  Try this as a "Custom Column" in Power Query Editor

 

=if [A]=null or [A]<=0 then [B] else [A]

image.png





Did I answer your question? Mark my post as a solution!

Proud to be a PBI Community Champion




Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

Find out what's new and trending in the Fabric community.

July PBI25 Carousel

Power BI Monthly Update - July 2025

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