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

We've captured the moments from FabCon & SQLCon that everyone is talking about, and we are bringing them to the community, live and on-demand. Starts on April 14th. Register now

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
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

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.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

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