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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
nesselman
Helper I
Helper I

Displaying Dates after a Selected Start Date for a specific Period

I would like to show 13 Weeks in a Table, using a "Start From" Week Slicer

I know I can use the Slicer as a BETWEEN, however, I really want the user to just pick a starting week and have the table show that week plus the next 12 weeks.

 

My Calendar includes:

  • Date 
  • Week-Start Date

I believe I need to create a second Calendar table for have the Slicer Start from and then a column in original Calendar to show "Display" or "Don't Display" then use that as a filter. 

Each time I do some sort of Column like that it comes back either blank, or all Display or all Dont Display.

 

I've looked a many, many responses, but most are for all data from a date or using relative date filters.

 

Any help or links for me to research, I'd appreciate.

 

2 ACCEPTED SOLUTIONS
amitchandak
Super User
Super User

@nesselman , if you want to select 1 week and want to show more than one week. then the slicer need to be on independent

 

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

 

or Use week Rank

 

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

 

 

where Week Rank is a column

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

View solution in original post

Thank you.  Your approach would have gotten me there.  What was important was the Relationship of the 2nd Date table.  PBI was making is a Many-to-Many and Both directions.  I had to fix that to be:  Many-to-One and Single then everything started working.

 

I also found this page and video good since it is where I saw on his screen that relationship difference.

 

Showing Results Before Or After A Selected Date Using DAX (enterprisedna.co)

 

Thank you.

View solution in original post

2 REPLIES 2
amitchandak
Super User
Super User

@nesselman , if you want to select 1 week and want to show more than one week. then the slicer need to be on independent

 

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

 

or Use week Rank

 

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

 

 

where Week Rank is a column

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

Thank you.  Your approach would have gotten me there.  What was important was the Relationship of the 2nd Date table.  PBI was making is a Many-to-Many and Both directions.  I had to fix that to be:  Many-to-One and Single then everything started working.

 

I also found this page and video good since it is where I saw on his screen that relationship difference.

 

Showing Results Before Or After A Selected Date Using DAX (enterprisedna.co)

 

Thank you.

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

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

MayPowerBICarousel1

Power BI Monthly Update - May 2024

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