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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
Anonymous
Not applicable

How to filter dates since last 2 calendar months including current month?

Hello,

 

I have a table with multiple columns, including, dates. I am trying to make a dynamic filter for the table visualization in Power BI, so that it will only show the data since the last 2 calendar months (starting from the first day of the month, 2 months ago) until the current month. So, in this case, as from 1 December 2021 until 28 February 2022.

 

I am thinking maybe do it in DAX? I don't know how to proceed. Any help is much appreciated!

 

DateAmountCountry
01/11/202144China
06/11/202144Germany
01/12/202148Indonesia
19/12/202150Kuwait
21/01/20223France
23/01/20223India
03/01/20221Indonesia
11/02/20226Brazil
13/01/20222Germany
14/02/20227Mexico
21/03/202212Poland
1 ACCEPTED SOLUTION
jdbuchanan71
Super User
Super User

@Anonymous 

Add a column to your calendar table like this.

Month Offset = DATEDIFF ( TODAY(), Dates[Date], MONTH )

Then you can set a filter on that column for <= 0 and >= -2 and that will give you the last 2 full months and the current month.

View solution in original post

2 REPLIES 2
phbronson
Frequent Visitor

Another simple solution is to use the "Date/Time Filters"

filter_past_2months.png

jdbuchanan71
Super User
Super User

@Anonymous 

Add a column to your calendar table like this.

Month Offset = DATEDIFF ( TODAY(), Dates[Date], MONTH )

Then you can set a filter on that column for <= 0 and >= -2 and that will give you the last 2 full months and the current month.

Helpful resources

Announcements
July PBI25 Carousel

Power BI Monthly Update - July 2025

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

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 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.