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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Reply
markyochoa
Helper I
Helper I

Reference date from a calendar table in a custom column

Hello all,

 

Pretty sure this is a straight forward answer I just can't seem to figure it out.

 

I have a custom calendar table that is fairly standard practice. It's a single column table with a bunch of dates that I can use as reference in measures. That works fine with measures, but is it possible to do the same thing for columns? 

 

I have a historical dashboard with a table that has all the historical data, and a column called "Snapshot Date" that has the date of the snapshot. The data also has a column "Date Created" that has the date created of a document.

 

I wanted to create a column that says if it was created within a week of a certain date in history. So something along the lines of:

 

IsWithinAWeek = IF(DATEDIFF(Table[Date Created], [SelectedDate], WEEK()) == -1, "Last Week")

 

Where [SelectedDate] = MAX(Calendar[Date])

 

This doesn't seem to be working. The actual implementation is a bit more complex that incorporates "Last week", "this week", and "next week", but this is the gist of it. 

 

EDIT: 

 

I forgot to mention, I'm doing this because I want the user to be able to use the calendar UI to pick a single date. So I'm doing the trick where you have a date slicer set to "Before", and I'm blocking the "After" side of the date picker and using MAX() to get the date. 

 

As such:

markyochoa_0-1694818179319.png

 

1 ACCEPTED SOLUTION
Ritaf1983
Super User
Super User

Hi @markyochoa 
If I understand you correctly and you want to do something "on the fly" and make some calculations as a calculated column based on user selection this is not possible.

If it is something else please share your data table and desired result.

If this post helps, then please consider Accepting it as the solution to help the other members find it more quickly

View solution in original post

2 REPLIES 2
markyochoa
Helper I
Helper I

Yeah I was afraid it wouldn't be possibe. Thanks. 

Ritaf1983
Super User
Super User

Hi @markyochoa 
If I understand you correctly and you want to do something "on the fly" and make some calculations as a calculated column based on user selection this is not possible.

If it is something else please share your data table and desired result.

If this post helps, then please consider Accepting it as the solution to help the other members find it more quickly

Helpful resources

Announcements
July 2024 Power BI Update

Power BI Monthly Update - July 2024

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

July Newsletter

Fabric Community Update - July 2024

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