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
domtrump
Helper II
Helper II

Calc column Flag if between two dates

Just need a simple calculated column

 

=if(MOHDEP1[FDDate]>= "03/01/23", 1,0)

 

This errors out. What is the proper syntax to do a simple date comparison? 

=if(MOHDEP1[FDDate]>= date(2023,3,1), 1,0) works, but I would think there is a shorter way to write this code?

 

Same with BETWEEN. To create a calculated column to flag records between two dates, is there a better way to write:

=if(MOHDEP1[FDDate]>= date(2023,3,1) && MOHDEP1[FDDate]<= date(2023,6,30), 1,0) ?

 

Thanks.

1 ACCEPTED SOLUTION
tamerj1
Super User
Super User

Hi @domtrump 

there are other few ways to that but they're no better than this one. You my use DATEVALUE or CONVERT-DATETIME but nothing I personally prettge DATE approach. No need to be frustrated I guess. 

View solution in original post

1 REPLY 1
tamerj1
Super User
Super User

Hi @domtrump 

there are other few ways to that but they're no better than this one. You my use DATEVALUE or CONVERT-DATETIME but nothing I personally prettge DATE approach. No need to be frustrated I guess. 

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.