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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

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
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel

Power BI Monthly Update - May 2024

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