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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
JC2022
Helper III
Helper III

Record and List to Table

Hi,

Can you please help me with a json datasource. I have lists and records as shown below, but I would like to create a Table from it.

 

1. See the column data.items. It is a column with "Record" which I can expand. Some expanded columns have values (which is great), but some have Lists.1.png

 

2. data.items.id is an expanded column with values, but data.items.autoProperties is a column with "List".

2.png

 

3. I have expanded column data.items.autoProperties with "Expand to new rows". That's why there are multiple rows for data.items.id = 4 and 135 etc. Some data.items.id have more rows than others, depending on the amount of records in the list.

In data.items.autoProperties it still shows "Record".

3.png

 

4. If I expand column data.items.autoProperties to data.items.autoProperties.name and data.items.autoProperties.value this will be the result.

4.png

 

5. But I would like to have data.items.autoProperties.name als columns and data.items.autoProperties.value als the value. With only one row for a unique data.items.id. Can you guys please help me?

1 ACCEPTED SOLUTION

Make sure you select your value column for the values in your pivot and choose "Don't Aggregate".

ppm1_0-1684324844927.png

Or here is an expression you can put in a custom column. Replace Custom with your column that has your list of records (before you expand, pivot, etc.).

let 
inputlist = [Custom],
fields = List.Transform(inputlist, each _[name]),
values = List.Transform(inputlist, each _[value]),
result = Record.FromList(values, fields)
in 
result

 

Pat

 

Microsoft Employee

View solution in original post

3 REPLIES 3
ppm1
Solution Sage
Solution Sage

Starting at your last picture, you should be able to pivot on the name columns and use the value column as the values. Select the name column and choose Pivot Column on the Transform tab. Have you tried that?

 

It should also be possible to use List.Transform to turn your list of records into a record (w/o having to initially expand the list and then pivot).

 

Pat

Microsoft Employee

Hi @ppm1,

this creates values of 1 and 0, depending if there is data (1) and when there is no data (0). But not the actual data itself.

Can you write me the code of your other solution (List.Transform), because I have tried some things but it didn't work out. I was getting all errors.

 

JC2022_0-1684245403422.png

 

Make sure you select your value column for the values in your pivot and choose "Don't Aggregate".

ppm1_0-1684324844927.png

Or here is an expression you can put in a custom column. Replace Custom with your column that has your list of records (before you expand, pivot, etc.).

let 
inputlist = [Custom],
fields = List.Transform(inputlist, each _[name]),
values = List.Transform(inputlist, each _[value]),
result = Record.FromList(values, fields)
in 
result

 

Pat

 

Microsoft Employee

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

Top Solution Authors
Top Kudoed Authors