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
msommerf
Helper III
Helper III

Find value between 2 dates

Can somebody please help?

I have a table which has financial periods which are defined between two dates as shown:

 

PERIODS TABLE

START DATE     END DATE     PERIOD

30/06/2013      27/07/2013        1

28/07/2013      24/08/2013        2

25/08/2013      28/09/2013        3

 

I have a date table with my dates in it:

 

DATES

DATE

01/07/2013

02/07/2013

28/07/2013

27/08/2013

 

I am trying to add a calculated column to add my periods to my date table as follows:

 

DATE            PERIOD

01/07/2013     1

02/07/2013     1

28/07/2013     2

27/08/2019     3

 

I have tried the following DAX but get an error:

 

Column = calculate (

     values (    PERIOD TABLE [PERIOD]),

     filter (PERIOD TABLE,

     PERIOD[START DATE]<=MAX(DATE[DATE]) && PERIOD[END DATE]>=MIN(DATE[DATE]))))

 

The resultant column is blank.

 

Can anyone advise as to what I am doing wrong?

Any assistance appreciated.

1 ACCEPTED SOLUTION
jdbuchanan71
Super User
Super User

Hello @msommerf 

Give this a try for making the calculated column in your date table.

Period = 
CALCULATE (
    MAX ( 'PERIOD TABLE'[Period] ),
    FILTER (
        'PERIOD TABLE',
        'PERIOD TABLE'[Start Date] <= Dates[Date] &&
        'PERIOD TABLE'[End Date] >= Dates[Date]
    )
)

View solution in original post

2 REPLIES 2
jdbuchanan71
Super User
Super User

Hello @msommerf 

Give this a try for making the calculated column in your date table.

Period = 
CALCULATE (
    MAX ( 'PERIOD TABLE'[Period] ),
    FILTER (
        'PERIOD TABLE',
        'PERIOD TABLE'[Start Date] <= Dates[Date] &&
        'PERIOD TABLE'[End Date] >= Dates[Date]
    )
)

Perfect! this works for me. Many thanks for your assistance.

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

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!

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
Top Kudoed Authors