Learn from the best! Meet the four finalists headed to the FINALS of the Power BI Dataviz World Championships! 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!
| User | Count |
|---|---|
| 57 | |
| 44 | |
| 32 | |
| 16 | |
| 14 |
| User | Count |
|---|---|
| 84 | |
| 70 | |
| 38 | |
| 27 | |
| 25 |