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

Get inspired! Check out the entries from the Power BI DataViz World Championships preliminary rounds and give kudos to your favorites. View the vizzies.

Reply
PPPBI
Regular Visitor

Same Period Last week in Slicer By default

Hi,

 

In one of my report I wanted to create the slicer that should always have default selection of latest date and offset it to 7 days.

 

Ex: If I am selecting 20-Feb 2023 in slicer then the graph should show the data for 20-Feb 2023 and 13-Feb 2023 (only 2 days of data), if 17-Feb 2023 is selected the it should data for 17-Feb 2023 and 10-Feb 2023 only. (excluding Saturday and Sundays)

 

PPPBI_0-1677683300542.png

 

Also it would be great if same slicer has "Custom Date" selection option.

 

Table Name [Sheet1]

Date Field Name [ Status Date]

Value Filed Name [Sales]

 

Thanks.

 

1 REPLY 1
amitchandak
Super User
Super User

@PPPBI , if you want select a week and want to show more than that, You need have slicer in independent date table

 

//Date1 is independent Date table, Date is joined with Table
new measure =
var _max = maxx(allselected(Date1),Date1[Rank])
var _min = _max -1
return
calculate( sum(Table[Value]), filter('Date', 'Date'[Rank] >=_min && 'Date'[Rank] <=_max))

 

 

Where Week rank is column in both date tables

 

Week Rank = RANKX('Date','Date'[Week Start date],,ASC,Dense)
OR
Week Rank = RANKX('Date','Date'[Year Week],,ASC,Dense) //YYYYWW format

 

 

Power BI — Week on Week and WTD
https://medium.com/@amitchandak.1978/power-bi-wtd-questions-time-intelligence-4-5-98c30fab69d3
https://community.powerbi.com/t5/Community-Blog/Week-Is-Not-So-Weak-WTD-Last-WTD-and-This-Week-vs-La...
https://www.youtube.com/watch?v=pnAesWxYgJ8

 

Need of an Independent Date Table:https://www.youtube.com/watch?v=44fGGmg9fHI

Full Power BI Video 20 Hours YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code FABINSIDER for a $400 discount!

FebPBI_Carousel

Power BI Monthly Update - February 2025

Check out the February 2025 Power BI update to learn about new features.

March2025 Carousel

Fabric Community Update - March 2025

Find out what's new and trending in the Fabric community.