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

Data Days is here! Join us now for 60+ days of learning, challenges, and connection. Learn more

Reply
Anonymous
Not applicable

Expression Error IF is Then else

Hello Everybody, 

 

i have a probem in writing an if function with power query. 

 

I have table with "delivery date wish customer" (gepl.Versanddatum) and "delivery date possible" (machbarer Termin)

 

Problem is that it could be that the "delivery date possible" is a empty cell because the date is equal to "delivery date wish customer".

 

Therefore i wrote the following formula with the formula editor from "add customer column"

 

if [#"xmr_vk_analyse (2).Machbarer Termin"] is null then Date.WeekOfYear [#"xmr_vk_analyse (2).gepl. Versanddatum"] else Date.WeekOfYear [#"xmr_vk_analyse (2).Machbarer Termin"]

 

This leads to the error message shon in the picture at the end of this contribution.

 

What is wrong with this formula? 

 

Thanks in advance for helping. Screenshot 2021-11-25 121158.png

1 ACCEPTED SOLUTION
mahoneypat
Microsoft Employee
Microsoft Employee

Please try this instead

 

if [#"xmr_vk_analyse (2).Machbarer Termin"] = null then Date.WeekOfYear ([#"xmr_vk_analyse (2).gepl. Versanddatum"]) else Date.WeekOfYear ([#"xmr_vk_analyse (2).Machbarer Termin"])

 

Pat





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


View solution in original post

2 REPLIES 2
mahoneypat
Microsoft Employee
Microsoft Employee

Please try this instead

 

if [#"xmr_vk_analyse (2).Machbarer Termin"] = null then Date.WeekOfYear ([#"xmr_vk_analyse (2).gepl. Versanddatum"]) else Date.WeekOfYear ([#"xmr_vk_analyse (2).Machbarer Termin"])

 

Pat





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


Anonymous
Not applicable

Hey Mahoneypat, 

 

thanks for your help. It works. 

 

Question: Could you please explain to me why if to use " = null" instead of is? Or did I get it wrong and I have allways to use  "sings" of logical operations as "=;<;>" when I'm writting a IF statement?

Helpful resources

Announcements
Fabric Data Days is here Carousel

Fabric Data Days 2026

Don't miss out on Data Days, June 15 through August 7. Learn Fabric, Power BI, SQL, AI and more.

May Power BI Update Carousel

Power BI Monthly Update - May 2026

Check out the May 2026 Power BI update to learn about new features.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.