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

Get inspired! Check out the entries from the Power BI DataViz World Championships preliminary rounds and give kudos to your favorites. View the vizzies.

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

Regards,
Rita Fainshtein | Microsoft MVP
https://www.linkedin.com/in/rita-fainshtein/
Blog : https://www.madeiradata.com/profile/ritaf/profile

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

Regards,
Rita Fainshtein | Microsoft MVP
https://www.linkedin.com/in/rita-fainshtein/
Blog : https://www.madeiradata.com/profile/ritaf/profile

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

FebPBI_Carousel

Power BI Monthly Update - February 2025

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

Feb2025 NL Carousel

Fabric Community Update - February 2025

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

Top Solution Authors
Top Kudoed Authors