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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
joshua1990
Post Prodigy
Post Prodigy

Expand Data between two dates

I have a table in Excel / Power Query that has the following structure:

  • We have the Article and the Country in Column A and B
  • Column C shows us the Quarter
  • Then we have Column D and E that shows are the effective from and to date (It is always a Monday)
  • In Column F we have the Sales Target per Group
  • And in the last column we have the Target Value
PPCLocationIDCycleEffective fromEffective untilGroup Value 
A1Q12024-01-012024-04-01A1    135.540
A1Q12024-01-012024-04-01A2    180.718
A1Q12024-01-012024-04-01A3                -  
A1Q12024-01-012024-04-01A4    532.836
A1Q12024-01-012024-04-01A5    232.353
A2Q12024-01-012024-04-01A1         6.672
A2Q12024-01-012024-04-01A2         8.896
A2Q12024-01-012024-04-01A3       34.311
A2Q12024-01-012024-04-01A4       58.821
A2Q12024-01-012024-04-01A5       11.436
A3Q12024-01-012024-04-01A1         4.707
A3Q12024-01-012024-04-01A2         6.278
A3Q12024-01-012024-04-01A3       24.213
A3Q12024-01-012024-04-01A4       78.741
A3Q12024-01-012024-04-01A5         8.070
A1Q22024-04-082024-07-08A1    135.540
A1Q22024-04-082024-07-08A2    180.718
A1Q22024-04-082024-07-08A3                -  

Now, I would like to have a table in the end that fills the same elements into the dates between the from and until date.

So, I would like to get the values extrapolated for the weeks between the effective from and until date.

See the expected result below:

ArticleCountryQuarterDateGroup Value 
A1Q12024-01-01A1                          135.540
A1Q12024-01-01A2                          180.718
A1Q12024-01-01A3                                      -  
A1Q12024-01-01A4                          532.836
A1Q12024-01-01A5                          232.353
A1Q12024-01-08A1                          135.540
A1Q12024-01-08A2                          180.718
A1Q12024-01-08A3                                      -  
A1Q12024-01-08A4                          532.836
A1Q12024-01-08A5                          232.353
A1Q12024-01-15A1                          135.540
A1Q12024-01-15A2                          180.718
A1Q12024-01-15A3                                      -  
A1Q12024-01-15A4                          532.836
A1Q12024-01-15A5                          232.353

 

How would you do that with Power Query?

If required, I have a calendar table with all the dates etc.

3 REPLIES 3
slorin
Super User
Super User

Hi @joshua1990 

 

add column

 

List.Dates(
[Effective from],
Duration.Days([Effective until]-[Effective from])/7+1,
#duration(7,0,0,0)
)

then expand

 

Stéphane

AlienSx
Super User
Super User

let
    Source = Excel.CurrentWorkbook(){[Name="Table2"]}[Content], 
    comb = Table.CombineColumns(
        Source, 
        {"Effective from", "Effective until"},
        (w) => List.Generate(
            () => w{0}, 
            (x) => x <= w{1},
            (x) => Date.AddDays(x, 7)
        ),
        "Date"
    ),
    result = Table.ExpandListColumn(comb, "Date")
in
    result

then sort and/or rename columns to your liking

Omid_Motamedise
Super User
Super User

What is the transformation logic?


If my answer helped solve your issue, please consider marking it as the accepted solution.

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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