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

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes! Register now.

Reply
Samhunt
Helper II
Helper II

Date smaller than first day of current month

Hello Everyone, 

 

I am new to this so I require some help. 

 

Because I add my data on the first days of next month I want to create a column Query that will mark all dates that are smaller than the first day of the current month to be marked as past and all the dates in the current month and onward to be marked as future

 

So this is what I tried which is wrong as I received an error in my column

 

=if [date] < Date.StartOfMonth(DateTime.LocalNow()) then "Past" else "Future"

 

So for example now we have February, I want in the new column all dates before the 01/02/2024 to be marked as past

 

Thanks for your time

1 ACCEPTED SOLUTION
dufoq3
Super User
Super User

The issue is with  DateTime.LocalNow(), because it is as datetime - just add Date.From before it.

 

 

if Date.From([date]) < Date.StartOfMonth(Date.From(DateTime.LocalNow())) then "Past" else "Future"

 

 

 


Note: Check this link to learn how to use my query.
Check this link if you don't know how to provide sample data.

View solution in original post

2 REPLIES 2
dufoq3
Super User
Super User

The issue is with  DateTime.LocalNow(), because it is as datetime - just add Date.From before it.

 

 

if Date.From([date]) < Date.StartOfMonth(Date.From(DateTime.LocalNow())) then "Past" else "Future"

 

 

 


Note: Check this link to learn how to use my query.
Check this link if you don't know how to provide sample data.

Hi @dufoq3 


Works as a charm thank you very much really appreciated

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

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

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.

Top Kudoed Authors