cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
shaunguyver
Helper III
Helper III

Filter dates in table to show dates older than 30 days

I have a table with dates, and I want to filter the table to only show values where the date is older than 30 days (as of today). How do I do this?

1 ACCEPTED SOLUTION
DoubleJ
Responsive Resident
Responsive Resident

Hi

You can add a calculated column to your dates table with a formula that checks whether the day falls within the last 30 days. You can then filter your visuals with this column.

 

Last30Days = 
IF(
    DATEDIFF(Dates[Date],TODAY(),DAY) <=30,
    TRUE(),
    FALSE())


Last30Days.png

Hope this helps (if so please give a kudo)
JJ

 

 

View solution in original post

3 REPLIES 3
DoubleJ
Responsive Resident
Responsive Resident

Hi

You can add a calculated column to your dates table with a formula that checks whether the day falls within the last 30 days. You can then filter your visuals with this column.

 

Last30Days = 
IF(
    DATEDIFF(Dates[Date],TODAY(),DAY) <=30,
    TRUE(),
    FALSE())


Last30Days.png

Hope this helps (if so please give a kudo)
JJ

 

 

View solution in original post

Thanks for the suggestion - I've tried to do this, but when I input the formula I get the following error message:

 

"Expression error: The name 'IF' wasn't recognized. Make sure it's spelled correctly."

 

Any idea why? I can't seem to find another way of doing this

Hi,

The formula suggested is a measure.  Go to Modelling > New Measure.  You are writing that formula in the Query Editor.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Helpful resources

Announcements
Power BI December 2021 Update_carousel 768x460.jpg

Check it Out!

Click here to read more about the December 2021 Updates!

User Group Leader Meeting January 768x460.png

Calling all User Group Leaders!

Don't miss the User Group Leader meetings on January, 24th & 25th, 2022.

Jan 2022 Dev Camp 768x460 copy.png

Power BI Dev Camp- January 27th, 2022

Mark your calendars and join us for our next Power BI Dev Camp!

Top Solution Authors
Top Kudoed Authors