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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
jgdgsf2
Frequent Visitor

Return value from custom calendar if date is between two dates

Hi all,

 

I have an issue that I'm sure is very simple to solve but so far haven't been able to crack!

 

Firstly, I have a custom calendar table that looks like this:

 

WeekNumberWeekEndsOnYearWeekYearPreviousWeek
108-Aug-20202001/202001-Aug-20
215-Aug-20202002/202008-Aug-20
322-Aug-20202003/202015-Aug-20
429-Aug-20202004/202022-Aug-20

 

And so on and so on for the full 52 weeks.

 

I have a separate data set like the below:

 

IDCompletion timeEmailNameEmployee NameLocationWeekYear
5329/09/2021 10:47anonymous    
29203/03/2022 15:14anonymous    
11205/11/2021 13:57anonymous    
12512/11/2021 09:01anonymous    

 

All I want to do is get the WeekYear from my custom Calendar table based on the Completion Time column - if it falls between xx-xx-xxxx and xx-xx-xxxx then the WeekYear is xx/xxxx.

 

Is there an easy way of achieving this? Thanks in advance!

1 ACCEPTED SOLUTION
speedramps
Super User
Super User

HI jgdgsf2

 

It is really easy, you just need to have the same key on both tables

eg date to date

or week to week 

not date to week !

 

Option1 (date  to date) - best option !

Create a proper calendar table with arceord for every date (eg 01/01/2020 to 31/12/2023) with

  • date
  • week ending date
  • year
  • week/year
  • previous week

 

Then create a 1:M relationship form calandar[date] to facttable[competion date].

You can now get the weekyear

 

watch this video ... 

https://www.youtube.com/watch?v=BtYn1hfdSAM

 

 

 

Option 2 (week to week)  :-

In Power Query add an extra colum to your fact table 

Date.EndOfWeek([completion date], day of week number)

 

you can then build a relation and get your WeekYear

 

 

Please click thumbs up and Accept as Solution

View solution in original post

2 REPLIES 2
speedramps
Super User
Super User

HI jgdgsf2

 

It is really easy, you just need to have the same key on both tables

eg date to date

or week to week 

not date to week !

 

Option1 (date  to date) - best option !

Create a proper calendar table with arceord for every date (eg 01/01/2020 to 31/12/2023) with

  • date
  • week ending date
  • year
  • week/year
  • previous week

 

Then create a 1:M relationship form calandar[date] to facttable[competion date].

You can now get the weekyear

 

watch this video ... 

https://www.youtube.com/watch?v=BtYn1hfdSAM

 

 

 

Option 2 (week to week)  :-

In Power Query add an extra colum to your fact table 

Date.EndOfWeek([completion date], day of week number)

 

you can then build a relation and get your WeekYear

 

 

Please click thumbs up and Accept as Solution

Hi speedramps,

 

Thank you very much - all sorted and working with the first solution you offered!

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors