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
hdavies_d
Frequent Visitor

Week End Date Filter to look back X weeks and ahead X weeks

Hello!

 

I am working on a report in Power BI Desktop. I am looking at data week over week using 'Week End Date' (Monday - Sunday)

 

On one page of my report, I specifically want to have my visuals show the Last 3 Weeks AND the next 3 weeks - But I need this to be dynamic so as we move forward the selection updates

 

Example:

TODAY the weeks that will show are -

last 3 weeks --- Week ending 9/20/2020, 9/27/2020, 10/04/2020 AND

next three weeks --- Week ending 10/11/2020, 10/18/2020,  10/25,2020

 

Then next week, all of those would adjust forward a week.

 

Does anyone have any suggestions for how to go about this? Is there a way to write a measure, a new column, or table to easily accomplish this?

 

 

1 ACCEPTED SOLUTION

let's say you have a [date]  column in your calendar table.

 

so the calculated column would be

 

InRange = if([date]>TODAY()-21 && [date]<TODAY+21,1,0)

 

or similar.

View solution in original post

3 REPLIES 3
lbendlin
Super User
Super User

yes, add a calculated column to your calendar table.  Each time your dataset gets refreshed that column will compute/flag the dates in your desired range.  Then use that calculated column in a slicer or as a visual/page/report filter.

@lbendlin  So what would that calculation look like for creating the column / how do I write that?

 

Thank you!

let's say you have a [date]  column in your calendar table.

 

so the calculated column would be

 

InRange = if([date]>TODAY()-21 && [date]<TODAY+21,1,0)

 

or similar.

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.