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
Birinder
Helper III
Helper III

How to repeat same set or number of values for each row in Power Query.

Hi Community,

I have one query.
Does anybody know how Can I have a same set or same number of values for each row.
I will explain it better with an example.
Suppose I have a column named as "KEY" in a table named as "Date".

Birinder_0-1685446959936.png


I want to have year from 2022 to next 4 years i.e. till 2026 for each key. Like this:

Birinder_1-1685447036145.png

 

I have tried doing this, But it is not working:

let
    Source = Table.FromList(List.Distinct(#"Full BECF"[KEY])),
    StartYear = 2022,
    EndYear = 2026,
    NumberofYears = EndYear-StartYear,
    Years = List.Generate(
        () => [i=0, year = StartYear],
        each [i] < NumberofYears,
        each [i=[i]+1,year = [year]+1],
        each [year]
    ),
    Converted = Table.FromList(Years,Splitter.SplitByNothing(),{"Year"},null,ExtraValues.Error),
    Merged = Table.NestedJoin(Source,{"Column1"},Converted,{"Year"},"NewColumn",JoinKind.FullOuter),
    Expanded = Table.ExpandTableColumn(Merged,"NewColumn",{"Year"},{"NewColumn.Year"})
in
    Expanded


Can you guys help me in achieving this.
Much Much thanks in Advance.
 

1 ACCEPTED SOLUTION
ppm1
Solution Sage
Solution Sage

Start with your intial table and add a custom column with this expression

 

= {2022..2026}

 

Then hit the expand button in the column header to expand that list to new rows.

 

Pat

 

Microsoft Employee

View solution in original post

2 REPLIES 2
ppm1
Solution Sage
Solution Sage

Start with your intial table and add a custom column with this expression

 

= {2022..2026}

 

Then hit the expand button in the column header to expand that list to new rows.

 

Pat

 

Microsoft Employee

@ppm1 Thanks a lot.
Crazy, how much time I was wasting instead of this simple code.

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