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

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes! Register now.

Reply
nicholastrausch
Frequent Visitor

Dynamic Week Offset based on Slicer Value

Ok.. been staring at this for too long and need help.  I have a date table where I use a Week Counter and then Calculate to determine the Week Counter value for current week based upon TODAY() being equal to a date in the table.  It then offsets (0, -1, -2, -3, etc) accordingly.  Need to add a little complexity to this though, in fact that I need to be able to pass in the date that I want to set as the "0" baseline through a slicer value. I have created a parameter table and can pass the value (trying to swap in DTM value for TODAY() ), but it errors out.  The result I'm trying to get is for the [Dynamic Week] field below.  Can anyone advise on how to take the Relative Week column below and have it accept a value from a slicer?

 

Week Counter = CALCULATE(DISTINCTCOUNT('Week Relative LUT'[ISO Year Week]),all('Week Relative LUT'),'Week Relative LUT'[ISO Year Week]<=EARLIER('Week Relative LUT'[ISO Year Week]))
Relative Week = 'Week Relative LUT'[Week Counter] -
                CALCULATE(
                    SUM('Week Relative LUT'[Week Counter]),
                    All('Week Relative LUT'),
                    TODAY()='Week Relative LUT'[Date])
snip1.PNG
1 REPLY 1
Anonymous
Not applicable

Hi there. Would you please be more descriptive about this problem? Also, would you please format code using https://www.daxformatter.com/? However, from what I understand, you want to have something dynamic that will change based on a value taken from another table (slicer). Well, in such a case you have to create a measure, there is no way to put it in a column. Please remember that a column creates (static) values when the model is loaded/refreshed. You can only have a measure that will respond to selections in a slicer.

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.