Power BI is turning 10, and we’re marking the occasion with a special community challenge. Use your creativity to tell a story, uncover trends, or highlight something unexpected.
Get startedJoin 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.
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
Trailer | ActivityDate |
100 | 06/01/2025 |
101 | 05/22/2025 |
102 | 05/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:
Trailer | ActivityDate |
101 | 05/22/2025 |
102 | 05/15/2025 |
Any assistance is greatly appreciated 👍
Thanks
Solved! Go to Solution.
@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:
If I answered your question please mark my post as the solution, it helps others with the same challenge find the answer!
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
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
)
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 🍻
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
@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:
If I answered your question please mark my post as the solution, it helps others with the same challenge find the answer!
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
58 | |
55 | |
55 | |
37 | |
30 |
User | Count |
---|---|
78 | |
64 | |
45 | |
43 | |
40 |