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

Learn from the best! Meet the four finalists headed to the FINALS of the Power BI Dataviz World Championships! Register now

Reply
Khpuryear
Helper I
Helper I

Dax for Values that are 30 Days+ Old

Hi There 👋

 

I'm having trouble creating a DAX measure/column that only contains records with a date that is less than, or equal to 30 days prior to today. This is applicable to one table (tableTrailers), and the table structure is 

TrailerActivityDate
10006/01/2025
10105/22/2025
10205/15/2025

 

It should always be based on today's date. So, if I run the report today, it's based on 06/23/2025. Using today as an example and the table above, if I'm looking to pull trailers that haven't had any activity in the last 30 days, the expected result would be:

 

TrailerActivityDate
10105/22/2025
10205/15/2025

 

Any assistance is greatly appreciated 👍

 

Thanks

3 ACCEPTED SOLUTIONS
mark_endicott
Super User
Super User

@Khpuryear - here's the DAX for a calculated column:

 

Column = IF( 'Table'[ActivityDate] < TODAY() - 30, 1, 0 )

 

You can then add this to a visual as a filter:

 

mark_endicott_0-1750690696090.png

 

If I answered your question please mark my post as the solution, it helps others with the same challenge find the answer!

 

View solution in original post

Demert
Resolver III
Resolver III

Hi @Khpuryear  if you want to filter out the records that are older than 30 days you can filter them out by in Power Query by the following code:

= Table.SelectRows(AddOffsetMonth, each [ActivityDate] >= Date.AddDays( DateTime.LocalNow(),-30))

 

If you have a table visual and want to filter them out. 

ActivityDate30D= IF( 'Table'[ActivityDate] > TODAY()-30, 0, 1 )

 

And filter on this measure to only display 1

 

View solution in original post

MasonMA
Super User
Super User

Does each trailer have multiple activity records?

 

If there is one row per trailer then one of the intuitive ways would be to create one calculated column to flag those that are inactive for more that 30 days by using below calcualted column, then filter where 'InactiveFlag'= 1.

InactiveFlag =
IF (
    'table'[ActivityDate] <= TODAY() - 30,
    1,
    0
)

 

View solution in original post

4 REPLIES 4
MasonMA
Super User
Super User

Does each trailer have multiple activity records?

 

If there is one row per trailer then one of the intuitive ways would be to create one calculated column to flag those that are inactive for more that 30 days by using below calcualted column, then filter where 'InactiveFlag'= 1.

InactiveFlag =
IF (
    'table'[ActivityDate] <= TODAY() - 30,
    1,
    0
)

 

Ahh, nice. Didn't think about that approach, and that works. Much obliged 🍻

Demert
Resolver III
Resolver III

Hi @Khpuryear  if you want to filter out the records that are older than 30 days you can filter them out by in Power Query by the following code:

= Table.SelectRows(AddOffsetMonth, each [ActivityDate] >= Date.AddDays( DateTime.LocalNow(),-30))

 

If you have a table visual and want to filter them out. 

ActivityDate30D= IF( 'Table'[ActivityDate] > TODAY()-30, 0, 1 )

 

And filter on this measure to only display 1

 

mark_endicott
Super User
Super User

@Khpuryear - here's the DAX for a calculated column:

 

Column = IF( 'Table'[ActivityDate] < TODAY() - 30, 1, 0 )

 

You can then add this to a visual as a filter:

 

mark_endicott_0-1750690696090.png

 

If I answered your question please mark my post as the solution, it helps others with the same challenge find the answer!

 

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

February Power BI Update Carousel

Power BI Monthly Update - February 2026

Check out the February 2026 Power BI update to learn about new features.