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
GrantC101
New Member

previous month last month filter

Hello All

 

Looking at getting some help with hopefully a simple filter.

I have been using the basic filters for Data filtering and have been asked to provide seprate tables for last months and any information before last month. The "last month" is easy, i am struggling with everything before last month with out showing last month.

I am unfimilier with dax and can only use the built in functions.

hopefully this makes sense and hoping to get some help

 

1 ACCEPTED SOLUTION

I have managed to achieve this using the following;

each [Date Reported]<=Date.AddMonths(Date.From(Date.EndOfMonth(DateTime.LocalNow())),-2))

 

thank you for the help

View solution in original post

4 REPLIES 4
watkinnc
Super User
Super User

Oh, your original post mentioned DAX. It's even easier in Power Query. In the formula bar:

= Table.SelectRows(Name of PriorStep, each [DateColumnName] <= Date.EndOfMonth(Date.AddMonths(Date.From(DateTime.LocalNow()), -2)))

 

--Nate


I’m usually answering from my phone, which means the results are visualized only in my mind. You’ll need to use my answer to know that it works—but it will work!!
watkinnc
Super User
Super User

Calculate(Sum(SomeTable[ColumnName]), Filter(WhateverTable, WhateverTable[Date] <= EOMONTH(TODAY(), -1)))

 

--Nate


I’m usually answering from my phone, which means the results are visualized only in my mind. You’ll need to use my answer to know that it works—but it will work!!

Thank you for the quick reply how would I put this into Power Query Editor?

I have managed to achieve this using the following;

each [Date Reported]<=Date.AddMonths(Date.From(Date.EndOfMonth(DateTime.LocalNow())),-2))

 

thank you for the help

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