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
Anonymous
Not applicable

how to get list of Dates using two existing Dates Columns using DAX?

I have two Date Columns, eff_Date and End_Date and I want to create a new column which gives all the dates between the two dates present in a row.
For eg,
eff_date                  end_date
01-08-2012             30-05-2019
01-03-2012             29-02-2012
I want to get all the dates between these two dates(01-08-2012 and 30-05-2019) and (01-03-2012 and 29-02-2012)in DAX and not in M query, as End_date is a calculated column.

9 REPLIES 9
Ashish_Mathur
Super User
Super User

Hi,

I dont think this can be done in DAX.  If you can share the logic of generating the Dates in the end_date column, then those dates can be generated in M and then all dates between eff_date and end_date can be enumerated in M.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
Anonymous
Not applicable

Hello @Ashish_Mathur , 
Thanks for the prompt reply.
Here is my end_date DAX

end_date = var temp =
TOPN(
1,
FILTER (
ar_cmg_rate_Union,
ar_cmg_rate_Union[cmg] = EARLIER ( ar_cmg_rate_Union[cmg] )
&& (ar_cmg_rate_Union[eff_date]) > EARLIER( ar_cmg_rate_Union[eff_date] )
),ar_cmg_rate_Union[eff_date],DESC
)
Return
IF(MINX(temp,ar_cmg_rate_Union[eff_date])>
ar_cmg_rate_Union[eff_date],ar_cmg_rate_Union[eff_date]-1,BLANK())

Hi,

Please share the business logic in simple Engligh (rather than a formula) of how the dates in the end_date column should be generated.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
Anonymous
Not applicable

@Ashish_Mathur ,
so I have a column called eff_date and the end_date's logic is as follows:
end_date is one date previous to eff_date.
for example, 
if eff_date = 18/02/2018 then end_date is 17/02/2018.

Hi,

There is something i am missing.  To just subtract a date, why are you writing a complicated TOPN formula?


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
Anonymous
Not applicable

@Ashish_Mathur , This is because I have another column called 'cmg', and I need to filter eff_date based on this column

Hi,

I am willing ot help but i need complete information.  Let's divide the problem into 2 parts - one that of generating the end_date in M and another that of enumerating the dates between start and end_date.  Let's take part 1.  My request is:

  1. Share all tables required to generate the end_date column
  2. Explain the business logic
  3. Show the end result

The second part of the problem is easier to solve.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
AlB
Community Champion
Community Champion

Hi @Anonymous 

Where do you want all those dates exactly? You need to explain it better, ideally through an example.

One option is a calculated colum:

NewColumn =
CONCATENATEX ( CALENDAR ( Table1[eff_date], Table1[end_date] ), [Date ], ", " )

which will list all the dates in that same row. Another option is to create a new calculated table that will list the 2-tuples (eff_date, end_date) from your initial table repeatedly, as many times as dates are between them,  and each followed by one of those dates:

NewTable =
GENERATE (
    Table1,
    CALENDAR ( CALCULATE ( Table1[eff_date] ), CALCULATE ( Table1[end_date] ) )
)
Anonymous
Not applicable

Hey @AlB , 
I want it in a column.

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