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
PhilippDF
Frequent Visitor

Combining a list containing columns with a list containing rows

Hi everyone!

 

I have two lists I get via a web request through Json.Document(Web.Contents(...). One contains information about the table columns. The other contains the row values. I want to cobine those two lists to get a table.

 

  • The tow lists after converting them into a table:

PhilippDF_0-1665729113233.png

 

  • Expanding the column list gets me something like this:
columns
Header1
Header2
Header3
Header4

 

  • Expanding the rows list gets me something like this
rows
Value1OfHeader1
Value1OfHeader2
Value1OfHeader3
Value1OfHeader4
Value2OfHeader1
Value2OfHeader2
Value2OfHeader3
Value2OfHeader4
.....
Value[n]OfHeader4

 

I tried to transpose the table and than expand the column list first and than the rows list but that only leads to multipling the rows list by the number of headers.

 

Now I was thinking to add a custum column which adds a number to the rows. In my example that would be a repeating sequence from 1 to 4. Also the column headers would get an index. Here also from 1 to 4. With this numbering I could merge the two lists and than create a pivot table. But this seems to be to much for something like that. Maybe you have another idea. Thanks in advance 🙂

 

  • Index for column list
Indexcolumns
1Header1
2Header2
3Header3
4Header5

 

  • customID for rows list
customIDrows
1Value1OfHeader1
2Value1OfHeader2
3Value1OfHeader3
4Value1OfHeader4
1Value2OfHeader1
2Value2OfHeader2
3Value2OfHeader3
4Value2OfHeader4
..........
4Value[n]OfHeader4
1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @PhilippDF ,

 

Please take a look at my possible solution.

First, here's the sample data I reproduced.

vstephenmsft_0-1666084537080.png

 

1.Add as new query for two lists.

vstephenmsft_1-1666084588711.png

vstephenmsft_0-1666084666221.png

 

2.You can get these two lists. Then convert them to tables.

vstephenmsft_1-1666084704553.png

vstephenmsft_2-1666084711139.png

vstephenmsft_3-1666084778879.pngvstephenmsft_4-1666084794683.png

 

3.Then add an index in Value table directly.

vstephenmsft_5-1666084834965.png

vstephenmsft_7-1666084968595.png

 

4.In Value(2) table, first create an index column.

vstephenmsft_6-1666084957556.png

 

5. Divide Index column by 4. From Transform tab > (Number Column) Standard > Divide.

vstephenmsft_8-1666084999286.pngvstephenmsft_9-1666085008337.png

vstephenmsft_10-1666085045426.png

 

 

6. Round up Index column. Transform > (Number Column) Rounding > Round Up.

vstephenmsft_11-1666085069659.png

vstephenmsft_12-1666085075507.png

 

7.Group by the Index column, select "All rows".

vstephenmsft_13-1666085112651.png

vstephenmsft_14-1666085124877.png

vstephenmsft_15-1666085144372.png

 

8.Add a custom column to add a custom index column.

vstephenmsft_16-1666085185698.pngvstephenmsft_17-1666085193865.png

 

9.Remove the unneeded columns, expand the new column with tables.

vstephenmsft_18-1666085225338.png

vstephenmsft_19-1666085233248.png

 

10.Finall you can merge Value table with Value(2) table.

vstephenmsft_20-1666085271671.pngvstephenmsft_21-1666085279036.png

 

11.Expand the column, remove the index column, then pivot.

vstephenmsft_22-1666085318592.png

vstephenmsft_23-1666085333102.png

Since my sample data, such as "Value1OfHeader1" is text, the result will be wrong, and your data is of type number, which can get the desired result.

vstephenmsft_24-1666085360875.png

vstephenmsft_25-1666085436856.png

 

You can download my attachment for more details.

 

Best Regards,

Stephen Tao

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

 

 

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

Hi @PhilippDF ,

 

Please take a look at my possible solution.

First, here's the sample data I reproduced.

vstephenmsft_0-1666084537080.png

 

1.Add as new query for two lists.

vstephenmsft_1-1666084588711.png

vstephenmsft_0-1666084666221.png

 

2.You can get these two lists. Then convert them to tables.

vstephenmsft_1-1666084704553.png

vstephenmsft_2-1666084711139.png

vstephenmsft_3-1666084778879.pngvstephenmsft_4-1666084794683.png

 

3.Then add an index in Value table directly.

vstephenmsft_5-1666084834965.png

vstephenmsft_7-1666084968595.png

 

4.In Value(2) table, first create an index column.

vstephenmsft_6-1666084957556.png

 

5. Divide Index column by 4. From Transform tab > (Number Column) Standard > Divide.

vstephenmsft_8-1666084999286.pngvstephenmsft_9-1666085008337.png

vstephenmsft_10-1666085045426.png

 

 

6. Round up Index column. Transform > (Number Column) Rounding > Round Up.

vstephenmsft_11-1666085069659.png

vstephenmsft_12-1666085075507.png

 

7.Group by the Index column, select "All rows".

vstephenmsft_13-1666085112651.png

vstephenmsft_14-1666085124877.png

vstephenmsft_15-1666085144372.png

 

8.Add a custom column to add a custom index column.

vstephenmsft_16-1666085185698.pngvstephenmsft_17-1666085193865.png

 

9.Remove the unneeded columns, expand the new column with tables.

vstephenmsft_18-1666085225338.png

vstephenmsft_19-1666085233248.png

 

10.Finall you can merge Value table with Value(2) table.

vstephenmsft_20-1666085271671.pngvstephenmsft_21-1666085279036.png

 

11.Expand the column, remove the index column, then pivot.

vstephenmsft_22-1666085318592.png

vstephenmsft_23-1666085333102.png

Since my sample data, such as "Value1OfHeader1" is text, the result will be wrong, and your data is of type number, which can get the desired result.

vstephenmsft_24-1666085360875.png

vstephenmsft_25-1666085436856.png

 

You can download my attachment for more details.

 

Best Regards,

Stephen Tao

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

 

 

Daryl-Lynch-Bzy
Resident Rockstar
Resident Rockstar

Hi @PhilippDF - I would like to suggest the following:

 

  •  From the Column heading Json you want to create List to rename the Row headings.  These list will need to contain text value.  At the moment Index will be an Integer.  I best to change this to text.  Adding a pre-fix like "Column" is optional.  To get each use the following M expression to create 
RenameList = Table.ToRows( #"Previous Step") 
  •  For the Rows table, add the pre-fix to the Index column if you want.  You need to pivot the custom column to create a table with four headings (i.e. "Column1", "Column2", "Column4", "Column4" ).  The key is to change the aggregation to "Don't Aggregate"

DarylLynchBzy_0-1665763129102.png

  • Finally you need to use the Two lists to rename the Column1 to Heading1.  Add you lists like so.
#"Renamed Columns" = Table.RenameColumns( #"Pivot Step", RenameList ) 

 

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