Forum Discussion

markyochoa's avatar
markyochoa
Icon for Helper I rankHelper I
3 years ago
Solved

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:

 

  • 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

2 Replies

  • 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