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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
NZCraig
Helper I
Helper I

If statements with multiple null conditions

Hi,

 

I am slowly learning Power Query M, but I've gone down a rabbit hole and neeed some help to correct my thinking please! I need to return a column that provides a single date from multiple date fields, based on a heirarchy.

 

The plain language version is:

If the [assignment.scheduledate] date field is not empty, return this date, unless the [schedstart] field has a date and this date is greater than the [assignment.scheduledate].

If the [assigment.schedule] date is not empty then return the [schedstart] date field. 

If the assignment.schedule date and the schedstart date fields are both empty, return the targstartdate field.

 

I've tried many variations of the below, but cannot seem to get an error in the results when there is an [assignment.scheduledate] . Any help would be very much appreciated!

 

if [assignment.scheduledate] <> null and ([assignment.scheduledate] >= [shedstart]) then [assignment.scheduledate] else
if [assignment.scheduledate] <> null and ([assignment.scheduledate] < [shedstart]) then [schedstart] else
if [assignment.scheduledate] is null and [schedstart] <> null then [schedstart] else
if [assignment.scheduledate] is null and [schedstart] is null then [targstartdate] else null)

 

1 REPLY 1
dax
Community Support
Community Support

Hi @NZCraig , 

What is your error information of above expression? I think you need to delete the ")" at the end of expression. In addition, if possible, could you please inform me more detailed information(such as your expected output and your sample data (by OneDrive for Business))? Then I will help you more correctly.

Please do mask sensitive data before uploading.

Thanks for your understanding and support.
Best Regards,
Zoe Zhi

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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