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
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
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.

Top Solution Authors