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

Level up your Power BI skills this month - build one visual each week and tell better stories with data! Get started

Reply
Evandam
Helper II
Helper II

check if a financial month is closed

I have created a dynamic date table in Power Query.

I now want to add a column that shows if a the financial month is closed.

 

Monthend close is ready each 15th of the month.

So the month may 2023 is closed on the 15th of june.

 

i have a date column as well as a year-month column available in the calender table i created in Power Query.

 

Difficulty i think occurs in february and because i want to take into account the 15th of the current month.

 

Who can assist/help me with this challenge?

 

 

1 ACCEPTED SOLUTION

The proper solution is the following:

 

if
Date.Year([Date]) < Date.Year(Date.From(DateTime.LocalNow()))
then
1
else if
Date.Day(Date.From(DateTime.LocalNow())) <15 
and Date.Month([Date]) < Date.Month(Date.From(DateTime.LocalNow())) -2
then 1
 
else if
Date.Month([Date]) < Date.Month(Date.From(DateTime.LocalNow())) -1
then 1
else 0

View solution in original post

5 REPLIES 5
lbendlin
Super User
Super User

Where do you plan to store that "closed" flag?  In your calendar table?

@lbendlin yes in the calender table

You can flag any date that is older than TODAY()-15.

imo not the best approach because some months with 31 days, 30 and even 28 or 29 days. 

I think this will hold up:

each if
Date.Year([Date])<
Date.Year(Date.From(DateTime.LocalNow()))
then "TRUE"
else if Date.Year([Date]) >= Date.Year(Date.From(DateTime.LocalNow())) and  Date.Month([Date]) < Date.Month(Date.From(DateTime.LocalNow())) and Date.Day(Date.From(DateTime.LocalNow())) >14
then "TRUE" else "FALSE"
 
Can you agree or ??

The proper solution is the following:

 

if
Date.Year([Date]) < Date.Year(Date.From(DateTime.LocalNow()))
then
1
else if
Date.Day(Date.From(DateTime.LocalNow())) <15 
and Date.Month([Date]) < Date.Month(Date.From(DateTime.LocalNow())) -2
then 1
 
else if
Date.Month([Date]) < Date.Month(Date.From(DateTime.LocalNow())) -1
then 1
else 0

Helpful resources

Announcements
April Power BI Update Carousel

Power BI Monthly Update - April 2026

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

Fabric SQL PBI Data Days

Data Days 2026 coming soon!

Sign up to receive a private message when registration opens and key events begin.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

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.