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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
harshad_barge
Helper I
Helper I

A table of multiple values was supplied where a single value was expected.

I am trying to see if the "Calculated Date" values fall between "Dim_Employee_Position.From" and "Dim_Employee_Position.To" dates.
I am using DATESBETWEEN function. Its not working.

What I am doing wrong?

 

Boundary =
IF ( DATESBETWEEN('Ordinary Hours'[Calculation Date], [Dim_Employee_Position.From], [Dim_Employee_Position.To]),
BLANK() , "Out of Bounds"
)
 
All are date time fields
 
Capture.PNG
 
Thanks,
Harshad
1 ACCEPTED SOLUTION
v-gizhi-msft
Community Support
Community Support

Hi,

 

Please try to change your original column to this:

Boundary =
IF (
    'Ordinary Hours'[Calculation Date]
        IN DATESBETWEEN (
            'Ordinary Hours'[Calculation Date],
            [Dim_Employee_Position.From],
            [Dim_Employee_Position.To]
        ),
    BLANK (),
    "Out of Bounds"
)

 

Best Regards,

Giotto Zhi

View solution in original post

3 REPLIES 3
v-gizhi-msft
Community Support
Community Support

Hi,

 

Please try to change your original column to this:

Boundary =
IF (
    'Ordinary Hours'[Calculation Date]
        IN DATESBETWEEN (
            'Ordinary Hours'[Calculation Date],
            [Dim_Employee_Position.From],
            [Dim_Employee_Position.To]
        ),
    BLANK (),
    "Out of Bounds"
)

 

Best Regards,

Giotto Zhi

danextian
Super User
Super User

Hi @harshad_barge ,

 

As per MS documentation, DATESBETWEEN alone "Returns a table that contains a column of dates that begins with the start_date and continues until the end_date."  You are getting an error because it is not returning a single value but a table of dates. It is used together with CALCULATE to get a single value. 

 

If you need to check whether a date is within two dates, you can just use a simple IF formula. 

Boundary =
IF (
    'Ordinary Hours'[Calculation Date] >= 'Ordinary Hours'[Dim_Employee_Position.From]
        && 'Ordinary Hours'[Calculation Date] <= 'Ordinary Hours'[Dim_Employee_Position.To],
    BLANK (),
    "Out of Bounds"
)

 





Dane Belarmino | Microsoft MVP | Proud to be a Super User!

Did I answer your question? Mark my post as a solution!


"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.
Greg_Deckler
Community Champion
Community Champion

DATESBETWEEN is going to return a table of values. Specifically, it will return a table of all the dates between the parameters specified. You need to compare it to something to get a logical TRUE/FALSE statement.

 

Please see this post regarding How to Get Your Question Answered Quickly: https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

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.