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
kjohn10
Helper I
Helper I

Adding constant from table as filter to date column

I want to provide a selectable "window" of days (from -10 to +10) to add to a date column. The window of days will be a slicer and the user can select one, which should update the column of dates day value by that amount. That date column is used in other calculations so we can see how moving the original date affects other values.

I used a simple query to create the window of day values, but getting the selected value added to the date column isn't working.

Simple example pbix here. How can I get that filter (slicer) to add the day(s)?

 

1 ACCEPTED SOLUTION
v-huizhn-msft
Employee
Employee

Hi @kjohn10,

We can not create a dynamic calculated column based on slicer, please review this knowledge base. For your requirement, you can create a measure using the formula below rather than calculated column.

Adjusted Date_test =
DATEADD (
    FIRSTNONBLANK ( DateKey[Date], DateKey[Date] ),
    SELECTEDVALUE ( Query1[DayChange] ),
    DAY
)


Create a table visual, and select DateKey[Date], measure as value, you will get expected result as follows.

select 3 in slicerselect 3 in slicerselect -1 in slicerselect -1 in slicer
Please download attachment for more details.

Best Regards,
Angelia

View solution in original post

2 REPLIES 2
v-huizhn-msft
Employee
Employee

Hi @kjohn10,

We can not create a dynamic calculated column based on slicer, please review this knowledge base. For your requirement, you can create a measure using the formula below rather than calculated column.

Adjusted Date_test =
DATEADD (
    FIRSTNONBLANK ( DateKey[Date], DateKey[Date] ),
    SELECTEDVALUE ( Query1[DayChange] ),
    DAY
)


Create a table visual, and select DateKey[Date], measure as value, you will get expected result as follows.

select 3 in slicerselect 3 in slicerselect -1 in slicerselect -1 in slicer
Please download attachment for more details.

Best Regards,
Angelia

@v-huizhn-msft Thank you for the KB link; I've replicated your solution, this should work, but will take me some time to link in the other calcs. 

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.