cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
ibrahimsharaf
Microsoft
Microsoft

Getting all dates between 2 dates

Hello guys, I have 2 columns named, start date and end date, I want to create a column which contains all the dates between the after mentioned dates, for example

Untitled.png

 

 

 

31 REPLIES 31
osiel
Frequent Visitor

Hello! You are very kind to attend my query so fast, I just feel great! thank you very much. I am working on power query, but I will try to publish it and on purpose I subscribe to your blog. it's great. thank you very much.
I send you a big hug.

Sincerely

osiel

It is not working for the calculated column.

Can you please help me on this one?

It is not working for the calculated column.

Can you please help me on this one?

AshPower
Frequent Visitor

Hi,

I have a similar situation, where I wanted to get the list of dates between 2 dates. It worked perfectly..Except the the values corresponding to those list of dates are summed together.

May be its the use of 'Number' in , 

{ Number.From([StartDate])..Number.From([EndDate]) }

Is there a way to produce the same result but the values remain intact.

 

P.S I did use Day/Date, { Date.From([StartDate])..Date.From([EndDate]) }

It  didnt worked for me & gave error

"Expression.Error: We cannot apply field access to the type Function.
Details:
Value=Function
Key=LabEntryDate"

 

Any help will be greatly appreciated

Thank you.

In order to help you I need the full query code - could you pls post that here?

Imke Feldmann (The BIccountant)

If you liked my solution, please give it a thumbs up. And if I did answer your question, please mark this post as a solution. Thanks!

How to integrate M-code into your solution -- How to get your questions answered quickly -- How to provide sample data -- Check out more PBI- learning resources here -- Performance Tipps for M-queries

Anonymous
Not applicable

Hi,

 

 

I want to reproduce the same code but instead of days I need the amount of months between two dates.

 

Is that possible?

Hi,

Share some data and show the expected result.


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

Please check out the code I've provided in the post here: http://community.powerbi.com/t5/Desktop/Get-a-list-of-dates-from-range-and-schedule/m-p/174879#M7641...

It contains a full query code with sample data. Just copy it to the advanced editor.

(If you're not familiar with that, watch this video: https://www.youtube.com/watch?v=S9xlq5KUZ60 )

Imke Feldmann (The BIccountant)

If you liked my solution, please give it a thumbs up. And if I did answer your question, please mark this post as a solution. Thanks!

How to integrate M-code into your solution -- How to get your questions answered quickly -- How to provide sample data -- Check out more PBI- learning resources here -- Performance Tipps for M-queries

Hi ImkeF.

 

I need your help,  I am trying to generate a list of dates between a beginning and an ending date.  When i add your formula by going to Add column > Custom column, i get an error.  When i click on the error, the message is

 

DataFormat.Error: We couldn't convert to Number.
Details:
    Int. calculation start date=01-Aug-2016

 

Here is the file.

 

Thank you for your help.

 


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

Hi Ashish,

you've uses double square brackets in your formula. This doesn't work in M.

It works when you use this formula:

 

Table.AddColumn(#"Changed Type1", "Custom", each { Number.From([Int. calculation start date])..Number.From([Int. calculation end date]) })

Imke Feldmann (The BIccountant)

If you liked my solution, please give it a thumbs up. And if I did answer your question, please mark this post as a solution. Thanks!

How to integrate M-code into your solution -- How to get your questions answered quickly -- How to provide sample data -- Check out more PBI- learning resources here -- Performance Tipps for M-queries

Hi,

 

Thank you for such a prompt reply.


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

Helpful resources

Announcements
August 2022 update 768x460.jpg

Check it Out!

Click here to learn more about the August 2022 updates!

August 1 episode 9_no_dates 768x460.jpg

The Power BI Community Show

Watch the playback when Priya Sathy and Charles Webb discuss Datamarts! Kelly also shares Power BI Community updates.

Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

Top Solution Authors
Top Kudoed Authors