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

Dynamic Date Filter based on user selection

All, 

 

I am working on a report that will allow my company to look at both vendor and customer payments within the last 5 days, and I am looking for a way that I can create this logic using DAX. If we could just do the most recent five days only, the relative filter function would be perfect, but unfortunately that is not what our user is requesting.

 

Basically, the user wants to be able to make a date selection at any point in time within the data set and and immediately filter to the five days preceding that selected date. 

 

Additionally, we are hoping to sort and limit the lists to the top 10 payments (by amount) from each category. 

 

Would love the help from the community on where to get started with this ask. 

4 REPLIES 4
Icey
Community Support
Community Support

Hi @Anonymous ,

 

Is this problem solved?

 

 

Best Regards,

Icey

Icey
Community Support
Community Support

Hi @Anonymous ,

 

If I understand you correctly, you can refer to this post: 

Display Last N Months & Selected Month using Single Date Dimension in Power BI.

 

 

 

Best Regards,

Icey

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Anonymous
Not applicable

Can you please show us the model? Also, please show us what you'd like to see as the final result. You can fake it.

Thanks.

Best
D
Greg_Deckler
Super User
Super User

Well, you could use a TopN filter for that second part. For the first part, you could structure your measures like this:

 

Measure =
  VAR __Date = SELECTEDVALUE('Table'[Date])
  VAR __5DaysAgo = (__Date - 5) * 1.
  VAR __Table = FILTER('Table',[Date] >= __5DaysAgo && [Date] <= __Date)
RETURN
  <Some calculation across __Table>

 

 


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

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.