cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
abartozzi Member
Member

Expand a date range

Hi community, 

 

have this one fo you:

 

I have this table called TP (travel periods)

 

Travel StartTravel EndIndex
20/11/201812/12/2018TP1
10/01/20193/04/2019TP2
30/04/201926/06/2019TP3

 

what is needed is another table generated from the expansion of Travel Start and Travel End. Something looking like this:

 

Travel Index
Nov-18TP1
Dec-18TP1
Jan-19TP2
Feb-19TP2
Mar-19TP2
Apr-19TP2

 

this will be the conjuction between other tables to combine data together. 

 

I tried with some variables butt came out to be crap.

 

Thank you for your help

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Anonymous
Not applicable

Re: Expand a date range

Alright,

 

Then righ-click the original table and select Reference --> this creates another table that references the original TP table (i.e. if the TP table gets updated the updates also carry on to the expanded ), then apply the steps needed in the new table to get the desired result and maintain the origianl table.

 

An updated pbix: pbix

 

Br,

T

View solution in original post

3 REPLIES 3
Anonymous
Not applicable

Re: Expand a date range

Hi @abartozzi,

Here's how to do it with Power Query.

In the Query Editor, calculate the days in between the end and start dates:DatesBetween.PNG

 

 

 

 

 

 

 

 

 

 

 

Then add another column that generates all the dates between start and end:

List.Dates([Start],[Subtraction],#duration(1,0,0,0))


dateList.PNG

 

 

 

 

 

 

 

 

 

 

 

 

After that, just expand the new column with the date list.

 

Here's a pbix with everything: pbix

 

Br,

T

 

 

 

 

 

abartozzi Member
Member

Re: Expand a date range

Hi @Anonymous

 

thank you for this, however I need the expansion in a brand new table. 

That's why I would suggest a formulated column/table. 

 

But the TP table should remain as it is (it has another purpose)

 

 

Highlighted
Anonymous
Not applicable

Re: Expand a date range

Alright,

 

Then righ-click the original table and select Reference --> this creates another table that references the original TP table (i.e. if the TP table gets updated the updates also carry on to the expanded ), then apply the steps needed in the new table to get the desired result and maintain the origianl table.

 

An updated pbix: pbix

 

Br,

T

View solution in original post

Helpful resources

Announcements
Can You Solve These Challenge

Challenge: Can You Solve These?

Find out how to participate in the first Power BI 'Can You Solve These?' challenge.

Community News & Announcements

Community News & Announcements

Get your latest community news and announcements.

Virtual Launch Event

Microsoft Business Applications October Virtual Launch Event

Join us for an in-depth look at the new innovations across Dynamics 365 and the Microsoft Power Platform.

Community Kudopalooza

Win Power BI Swag with Community Kudopalooza!

Each week, complete activities and be qualified in the drawing for cool Power BI Swag.

Users Online
Currently online: 66 members 1,283 guests
Please welcome our newest community members: