Forum Discussion

saffronbows's avatar
saffronbows
Frequent Visitor
2 years ago

Create calculated column in Calendar table from range of dates in lookup table.

Hello, first post here. Please let me know how I might make my problem easy to reproduce. I am working in Power Query.

 

I would like to create a calculated column in a basic Calendar table from range of dates in my Lookup table. I want the column to be the related Lookup.[YRTR] value where [Calendar.Date] >= [Lookup.BEGIN_DATE] and [Calendar.Date] < [Lookup.Lead.BEGIN_DATE].

 

My lookup table has a couple hundred ordered values, each with a unique BEGIN_DATE. To this lookup table I have added Lead.BEGIN_DATE to be the BEGIN_DATE of the subsequent record. Here is a snippet:

YRTRBEGIN_DATELead.BEGIN_DATE
202251/9/20235/30/2023
202338/22/20221/9/2023

 

Thank you

3 Replies