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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
BJW
Frequent Visitor

Custom Column Help!

I have a column "Visit Date" and I need to create a custom column which will determine the following.

 

When Visit Date is Blank - then "Not Scheduled"

When Visit Date is less than today - then "Completed"

When visit date is greater than today - then "Scheduled"

 

I tried this, but I'm getting errors.

if [[Visit Date] <= DateTime.LocalNow() and [Visit Date]<> Null then "Completed",
else if [[Visit Date]> DateTime.LocalNow then "Scheduled",
else if [Visit Date]=Null then "Not Scheduled"

 

Anyone be able to assist in correcting my error?

 

thanks.

 

1 ACCEPTED SOLUTION
jthomson
Solution Sage
Solution Sage

Don't know if null should be case sensitive or not, but I'd put seeing if it's null as the first stage of your logic, something like:

 

if [Visit Date] = null then "Not Scheduled" else if [Visit Date] > Date.From(DateTime.LocalNow()) then "Scheduled" else "Completed"

View solution in original post

1 REPLY 1
jthomson
Solution Sage
Solution Sage

Don't know if null should be case sensitive or not, but I'd put seeing if it's null as the first stage of your logic, something like:

 

if [Visit Date] = null then "Not Scheduled" else if [Visit Date] > Date.From(DateTime.LocalNow()) then "Scheduled" else "Completed"

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.