Forum Discussion
How to get Columna name from list using mQuery power query
- 6 years ago
Hi vikas-jk ,
if all tables have the same name you can grab it from the first table like so:
Table.ExpandTableColumn(tableOfPages, "Column1", Table.ColumnNames(tableOfPages[Column1]{0}) )otherwise you have to query over whole column like so:
Table.ExpandTableColumn(
tableOfPages,
"Column1",
List.Distinct(List.Transform(
tableOfPages[Column1],
Table.ColumnNames
)
)
)
Hi vikas-jk ,
if all tables have the same name you can grab it from the first table like so:
Table.ExpandTableColumn(tableOfPages, "Column1", Table.ColumnNames(tableOfPages[Column1]{0}) )
otherwise you have to query over whole column like so:
Table.ExpandTableColumn(
tableOfPages,
"Column1",
List.Distinct(
List.Transform(
tableOfPages[Column1],
Table.ColumnNames
)
)
)
Not Sure, why this solution is marked as accepted it didn't worked for me.
As you have asked to show you JSON, here is the demo JSON, which I am getting from server.
[
{
"id": 1,
"firstName": "User 1",
"lastName": "Last name",
},
{
"id": 2,
"firstName": "User 2",
"lastName": "lastname 2"
}
]Note: I am getting lots of pages of data and using List.Generate with function to get all pages.