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

Data Days is here! Join us now for 60+ days of learning, challenges, and connection. Learn more

Reply
PowerBI123456
Post Partisan
Post Partisan

Dynamic Filtering

Hi, I am trying to see how many requests were put in for responses received in the last 7 days. However, the request could have happned before the 7 day window and I dont want to filter those out. Anyway to do a dynamic filter to include all requests that are before the last 7 days a response was received?

 

PowerBI123456_0-1612389135339.png

 

 

2 ACCEPTED SOLUTIONS

Hi @PowerBI123456 ,

I'm hoping I get what you to achieve.
There are two approaches I can think of.

One - create a calculated column to get the response date for each account and then use this column in  a date slicer for the last 7 days.

Days Count - Response Date to Selected Date =
VAR __RESPONSE_DATE =
    SELECTEDVALUE (
        'Dates (disconnected)'[Date],
        MAX ( 'Dates (disconnected)'[Date] )
    )
RETURN
    DATEDIFF ( SELECTEDVALUE ( 'Fact'[Date] ), __RESPONSE_DATE, DAY )


Two -  This one is more dynamic. Create a disconnected (no relationship to Fact) calendar table and several meausres to compute for the number of days from response to the selected date in the disconnected calendar table.

Dates (disconnected) = 
CALENDAR ( MIN ( 'Fact'[Date] ), MAX ( 'Fact'[Date] ) )
Response Date (Measure) = 
CALCULATE (
    MAX ( 'Fact'[Date] ),
    ALLEXCEPT ( 'Fact', 'Fact'[Account] ),
    'Fact'[Action] = "Response"
)
Days Count - SELECTED Date to Selected Date = 
VAR __SELECTED_DATE =
    SELECTEDVALUE (
        'Dates (disconnected)'[Date],
        MAX ( 'Dates (disconnected)'[Date] )
    )
RETURN
    DATEDIFF ( [Response Date (Measure)], __SELECTED_DATE, DAY )


For reference, refer to the sample pbix: https://drive.google.com/file/d/1hvUNGahLeo7TyZNvkNU1LNsDRi2acTEC/view?usp=sharing





Dane Belarmino | Microsoft MVP | Proud to be a Super User!

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


"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.

View solution in original post

Thank you! I had to tweak option 2 a little but it worked!

View solution in original post

6 REPLIES 6
parry2k
Super User
Super User

@PowerBI123456 sorry it is not clear to me at all, I'm sure it's me. I hope someone else can help who understood what you are looking for.



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

@parry2k No its okay, I am not explaining it well. What I am trying to solve is: For any responses received in the last 7 days, when were the requests put in and by who. So in my example, accounts 2 and 3 had a response within the last 7 days (2/1/21 for account 2 and 2/2/21 for account 3), so the requests would have been on 11/1/20 by Kate (account 2) and 1/3/21 by Jim (account 3). Account 1 wouldn't apply because its response happened more than 7 days ago. I can't add a page filter on the date because then I am filtering out all the requests since they happened more than 7 days ago. Does that help?

 

PowerBI123456_0-1612405446903.png

 

parry2k
Super User
Super User

@PowerBI123456 not fully clear what you are looking for?



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

@parry2k I want to determine when requests were put in, but only for responses in the last 7 days. So in the example below, I only care for accounts 2 and 3 since the response was in the last 7 days. When I add a date filter on the page, I will get the responses that happened in the 7 last days but will miss the corresponding requests since they were before 7 days. Does that make sense?

 

PowerBI123456_0-1612389474118.png

 

Hi @PowerBI123456 ,

I'm hoping I get what you to achieve.
There are two approaches I can think of.

One - create a calculated column to get the response date for each account and then use this column in  a date slicer for the last 7 days.

Days Count - Response Date to Selected Date =
VAR __RESPONSE_DATE =
    SELECTEDVALUE (
        'Dates (disconnected)'[Date],
        MAX ( 'Dates (disconnected)'[Date] )
    )
RETURN
    DATEDIFF ( SELECTEDVALUE ( 'Fact'[Date] ), __RESPONSE_DATE, DAY )


Two -  This one is more dynamic. Create a disconnected (no relationship to Fact) calendar table and several meausres to compute for the number of days from response to the selected date in the disconnected calendar table.

Dates (disconnected) = 
CALENDAR ( MIN ( 'Fact'[Date] ), MAX ( 'Fact'[Date] ) )
Response Date (Measure) = 
CALCULATE (
    MAX ( 'Fact'[Date] ),
    ALLEXCEPT ( 'Fact', 'Fact'[Account] ),
    'Fact'[Action] = "Response"
)
Days Count - SELECTED Date to Selected Date = 
VAR __SELECTED_DATE =
    SELECTEDVALUE (
        'Dates (disconnected)'[Date],
        MAX ( 'Dates (disconnected)'[Date] )
    )
RETURN
    DATEDIFF ( [Response Date (Measure)], __SELECTED_DATE, DAY )


For reference, refer to the sample pbix: https://drive.google.com/file/d/1hvUNGahLeo7TyZNvkNU1LNsDRi2acTEC/view?usp=sharing





Dane Belarmino | Microsoft MVP | Proud to be a Super User!

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


"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.

Thank you! I had to tweak option 2 a little but it worked!

Helpful resources

Announcements
Fabric Data Days is here Carousel

Fabric Data Days 2026

Don't miss out on Data Days, June 15 through August 7. Learn Fabric, Power BI, SQL, AI and more.

May Power BI Update Carousel

Power BI Monthly Update - May 2026

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

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.