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

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

Reply
ajay_gajree
Helper I
Helper I

Dates Between Flag

Hi

I am trying to create a Flag Column to tag a date column as 1 or 0 depending if it falls between 2 dates

I have tried

DateFlag =
IF(
DATESBETWEEN( Data [Date],
DATE(2020,01,15),
DATE(2020,02,14),
1,

0
)

This is giving me the error message

A table of multiple values was suppler where a single value was expected

Any help appreciated!
1 ACCEPTED SOLUTION
v-gizhi-msft
Community Support
Community Support

Hi,

 

For your issue, it is because DATESBETWEEN returns a range of date but not a single value.

So please try this calculated column:

Column = IF('Table'[Date] in DATESBETWEEN('Table'[Date],DATE(2020,1,15),DATE(2020,2,14)),1,0)

The result shows:

1.PNG

Hope this helps.

 

Best Regards,

Giotto Zhi

 

View solution in original post

4 REPLIES 4
v-gizhi-msft
Community Support
Community Support

Hi,

 

For your issue, it is because DATESBETWEEN returns a range of date but not a single value.

So please try this calculated column:

Column = IF('Table'[Date] in DATESBETWEEN('Table'[Date],DATE(2020,1,15),DATE(2020,2,14)),1,0)

The result shows:

1.PNG

Hope this helps.

 

Best Regards,

Giotto Zhi

 

ajay_gajree
Helper I
Helper I

I want to create this flag for every row in my table so it is a column

You could try and use FIRSTNONBLANK in your calculation like below

DateFlag = 
IF(CALCULATE(FIRSTNONBLANK('Table'[date],'Table'[date]),
DATESBETWEEN( 'Table'[date],
DATE(2020,01,15),
DATE(2020,02,14))),
1,
0
)

Or without using DATESBETWEEN

DateFlag = 
IF(
    'Table'[date] >= DATE(2020,01,15) && 
    'Table'[date] <= DATE(2020,02,14),1,0
  )

 

vanessafvg
Super User
Super User

@ajay_gajree  are you sure you creating a column and not a measure?  a measure wants an aggregation.





If I took the time to answer your question and I came up with a solution, please mark my post as a solution and /or give kudos freely for the effort 🙂 Thank you!

Proud to be a Super User!




Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 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
Top Kudoed Authors