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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
Berl21
Helper III
Helper III

Current month in power query

Hi,

 

I want to get a column that automatically says if the month is current or not. So as to make a filter based on it.

 

I used a function that works really well for years:

 

if Date.Year(DateTime.LocalNow() )= [Year] then "Current year" else Text.From ([Year])

 

if Date.Month(DateTime.LocalNow() )= [Month] then "Current month" else Text.From ([Month]) generates an error. 

 

I suppose the month column has to be formatted in specific way, which might be impacted by the region of the user. Should it be text, then in English? Or in the local language? Or do I have to use a number, then in which format? My tests don't work so far.

Can anyone help me with this?

Thanks,

Pauline.

1 ACCEPTED SOLUTION
Ahmedx
Super User
Super User

and this last month

Screenshot_2.png

View solution in original post

3 REPLIES 3
Berl21
Helper III
Helper III

@Ahmedx Thank you so much! Seems straightforward once you know the function exists 🙂 You saved my day!

Ahmedx
Super User
Super User

and this last month

Screenshot_2.png

Ahmedx
Super User
Super User

pls try

Int64.From(
Date.IsInCurrentMonth([Business Days]))

Screenshot_1.png

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.