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
Meera556
Helper I
Helper I

A date column containing duplicate dates was specified in the call to function 'DATESBETWEEN'

Hi,

 

I'm trying to create a new table for cretaing custom date range slicer as below

Date_filter = UNION(
                ADDCOLUMNS(DATESBETWEEN(table[date_column],TODAY()-30,today()),"Type","Default"),
                ADDCOLUMNS(CALENDAR(MIN(table[date_column]),MAX(table[date_column])),"Type","Custom"))
But while creating I'm getting 
A date column containing duplicate dates was specified in the call to function 'DATESBETWEEN' error
Can anyone help me with this
 
Thanks for your help in advance
4 REPLIES 4
Alican_C
Resolver II
Resolver II

DATESBETWEEN function generates a table of dates without ensuring uniqueness, which can result in duplicate dates when combined with other date tables.

Try:

 

Date_filter =
VAR DefaultDates =
SELECTCOLUMNS(
CALENDAR(TODAY() - 30, TODAY()),
"Date", [Date],
"Type", "Default"
)

VAR CustomDates =
SELECTCOLUMNS(
CALENDAR(MIN('table'[date_column]), MAX('table'[date_column])),
"Date", [Date],
"Type", "Custom"
)

RETURN
DISTINCT(
UNION(
DefaultDates,
CustomDates
)
)

bhanu_gautam
Super User
Super User

@Meera556 , Try this DAX measure

 

Date_filter =
UNION(
ADDCOLUMNS(
DATESBETWEEN(
DISTINCT(table[date_column]),
TODAY() - 30,
TODAY()
),
"Type", "Default"
),
ADDCOLUMNS(
CALENDAR(
MINX(DISTINCT(table[date_column]), [date_column]),
MAXX(DISTINCT(table[date_column]), [date_column])
),
"Type", "Custom"
)
)




Did I answer your question? Mark my post as a solution! And Kudos are appreciated

Proud to be a Super User!




LinkedIn






Hi @bhanu_gautam ,

 

I have tried using DISTINCT function then I'm getting the below error

DatesBetween and DatesInPeriod functions are only accepting date column reference as a first argument.

You can create both steps separetly

Step 1: Create a table with unique dates
UniqueDates = DISTINCT(table[date_column])
Step 2: Create the Date_filter table using the unique dates
Date_filter = UNION(
    ADDCOLUMNS(DATESBETWEEN(UniqueDates[date_column], TODAY() - 30, TODAY()), "Type", "Default"),
    ADDCOLUMNS(CALENDAR(MIN(UniqueDates[date_column]), MAX(UniqueDates[date_column])), "Type", "Custom")
)



Did I answer your question? Mark my post as a solution! And Kudos are appreciated

Proud to be a Super User!




LinkedIn






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.