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
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
FabCon Global Hackathon Carousel

FabCon Global Hackathon

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

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 Solution Authors
Top Kudoed Authors