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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
prvn8887
New Member

Date function for excluding last 3 months along and current month as well

I need help to exclude last 3 months data and current month data. Example: as of today I need data till 31st May 2023. Please help it's urgent. Thanks!

2 REPLIES 2
123abc
Community Champion
Community Champion

In Power BI, you can create a DAX measure to filter and exclude the last 3 months' data along with the current month's data. Assuming you have a date column named "Date" in your data table, you can use the following DAX measure to achieve this:

 

FilteredData = FILTER ( YourTableName, -- Replace with the name of your data table YourTableName[Date] < DATE(YEAR(TODAY()), MONTH(TODAY()), 1) && -- Excludes the current month YourTableName[Date] >= DATE(YEAR(TODAY()), MONTH(TODAY()) - 3, 1) -- Excludes the last 3 months )

 

Replace YourTableName with the name of your data table. This measure filters the data to include only rows where the date is earlier than the first day of the current month (excluding the current month) and no more than 3 months ago.

You can then use the "FilteredData" measure in your visualizations to display data up to the end of May 2023 if today's date is in June 2023.

image.jpg

 it's showing error as name DATE wasn't recognised. I'm working on power query and column name is PMTSUMMARY.......

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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

Top Solution Authors