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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
Khpuryear
Frequent Visitor

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 II
Resolver II

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
Skilled Sharer
Skilled Sharer

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
Skilled Sharer
Skilled Sharer

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 II
Resolver II

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

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

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