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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

30 60 90 day filter | how to remove old dates

Hello all. I am trying to create a 30,60,90 day filter for a table that has tasks, and then states their due date. Except the DAX formula keeps old dates, meaning dates that are older than today, as seen in the picture below. 

 

What did I need to add into my formula to remove the October 19, 2020 Due Date? 

 

The end result should be that when I select 30 days pending only one task appears, the November 1, 2020 task.

 

Days Pending = CALCULATE(MAX('Table'[Task Next Milestone Due Date]),
FILTER('Table','Table'[Task Next Milestone Due Date]<=TODAY()+SELECTEDVALUE('Days Pending'[Days Pending],MAX('Days Pending'[Days Pending]))))

 

beingandbrian_0-1603728436154.png

 

 

1 ACCEPTED SOLUTION
MFelix
Super User
Super User

Hi @Anonymous ,

 

You are only defining the top values for your filtering so in term of formula you are returning all the values from your table where the Milestone Due Date  is lower than TODAY + X days so all your values are within this values, you need to place also the lower value.

 

Rewrite your measure to :

 

Days Pending =
CALCULATE (
    MAX ( 'Table'[Task Next Milestone Due Date] ),
    FILTER (
        'Table',
        'Table'[Task Next Milestone Due Date]
            <= TODAY ()
                + SELECTEDVALUE (
                    'Days Pending'[Days Pending],
                    MAX ( 'Days Pending'[Days Pending] )
                )
            && 'Table'[Task Next Milestone Due Date] >= TODAY ()
    )
)

 

The formula after the && is returning all the values where the due date is higher than today, so now you have the following syntax:

 

Today <= Milestone Due Date <= Today + Xdays

 


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



View solution in original post

1 REPLY 1
MFelix
Super User
Super User

Hi @Anonymous ,

 

You are only defining the top values for your filtering so in term of formula you are returning all the values from your table where the Milestone Due Date  is lower than TODAY + X days so all your values are within this values, you need to place also the lower value.

 

Rewrite your measure to :

 

Days Pending =
CALCULATE (
    MAX ( 'Table'[Task Next Milestone Due Date] ),
    FILTER (
        'Table',
        'Table'[Task Next Milestone Due Date]
            <= TODAY ()
                + SELECTEDVALUE (
                    'Days Pending'[Days Pending],
                    MAX ( 'Days Pending'[Days Pending] )
                )
            && 'Table'[Task Next Milestone Due Date] >= TODAY ()
    )
)

 

The formula after the && is returning all the values where the due date is higher than today, so now you have the following syntax:

 

Today <= Milestone Due Date <= Today + Xdays

 


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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