Forum Discussion
Load Multi level Hierarichal JSON file and setup relation with 3 & 4th Level and other entity
- 9 years ago
Hi nssidhu,
I use your script to create a json file using the JSON Generator , then load the Json file to Power BI desktop. You will get the following Query Editor navigation.
Please click To table, and expanded the column by clicking the button highlighted in yellow background.
Expanded the column until there is no column can be expaned. Please see my Query statement.let Source = Json.Document(File.Contents("C:\Users\v-huizhn\Downloads\generated.json")), #"Converted to Table" = Table.FromList(Source, Splitter.SplitByNothing(), null, null, ExtraValues.Error), #"Expanded Column1" = Table.ExpandRecordColumn(#"Converted to Table", "Column1", {"UserId", "id", "tipSecurableSet"}, {"Column1.UserId", "Column1.id", "Column1.tipSecurableSet"}), #"Expanded Column1.tipSecurableSet" = Table.ExpandRecordColumn(#"Expanded Column1", "Column1.tipSecurableSet", {"id", "Clients"}, {"Column1.tipSecurableSet.id", "Column1.tipSecurableSet.Clients"}), #"Expanded Column1.tipSecurableSet.Clients" = Table.ExpandListColumn(#"Expanded Column1.tipSecurableSet", "Column1.tipSecurableSet.Clients"), #"Expanded Column1.tipSecurableSet.Clients1" = Table.ExpandRecordColumn(#"Expanded Column1.tipSecurableSet.Clients", "Column1.tipSecurableSet.Clients", {"@odata.type", "typeId", "Entityids", "Clientid"}, {"[email protected]", "Column1.tipSecurableSet.Clients.typeId", "Column1.tipSecurableSet.Clients.Entityids", "Column1.tipSecurableSet.Clients.Clientid"}), #"Expanded Column1.tipSecurableSet.Clients.Entityids" = Table.ExpandListColumn(#"Expanded Column1.tipSecurableSet.Clients1", "Column1.tipSecurableSet.Clients.Entityids") in #"Expanded Column1.tipSecurableSet.Clients.Entityids"
Finally, I get the samle table below.
>>so that we once select client we can see which users are assigned to that client and what entities they have associated.
You can create a slicer including the client, create a table visual including client and entities, when you select a value in slicer, the corresponding clients and entities should display as follows.
If you have any other issue, please feel free to ask.
Best Regards,
Angelia
Hi nssidhu,
I use your script to create a json file using the JSON Generator , then load the Json file to Power BI desktop. You will get the following Query Editor navigation.
Please click To table, and expanded the column by clicking the button highlighted in yellow background.
Expanded the column until there is no column can be expaned. Please see my Query statement.
let
Source = Json.Document(File.Contents("C:\Users\v-huizhn\Downloads\generated.json")),
#"Converted to Table" = Table.FromList(Source, Splitter.SplitByNothing(), null, null, ExtraValues.Error),
#"Expanded Column1" = Table.ExpandRecordColumn(#"Converted to Table", "Column1", {"UserId", "id", "tipSecurableSet"}, {"Column1.UserId", "Column1.id", "Column1.tipSecurableSet"}),
#"Expanded Column1.tipSecurableSet" = Table.ExpandRecordColumn(#"Expanded Column1", "Column1.tipSecurableSet", {"id", "Clients"}, {"Column1.tipSecurableSet.id", "Column1.tipSecurableSet.Clients"}),
#"Expanded Column1.tipSecurableSet.Clients" = Table.ExpandListColumn(#"Expanded Column1.tipSecurableSet", "Column1.tipSecurableSet.Clients"),
#"Expanded Column1.tipSecurableSet.Clients1" = Table.ExpandRecordColumn(#"Expanded Column1.tipSecurableSet.Clients", "Column1.tipSecurableSet.Clients", {"@odata.type", "typeId", "Entityids", "Clientid"}, {"[email protected]", "Column1.tipSecurableSet.Clients.typeId", "Column1.tipSecurableSet.Clients.Entityids", "Column1.tipSecurableSet.Clients.Clientid"}),
#"Expanded Column1.tipSecurableSet.Clients.Entityids" = Table.ExpandListColumn(#"Expanded Column1.tipSecurableSet.Clients1", "Column1.tipSecurableSet.Clients.Entityids")
in
#"Expanded Column1.tipSecurableSet.Clients.Entityids"
Finally, I get the samle table below.
>>so that we once select client we can see which users are assigned to that client and what entities they have associated.
You can create a slicer including the client, create a table visual including client and entities, when you select a value in slicer, the corresponding clients and entities should display as follows.
If you have any other issue, please feel free to ask.
Best Regards,
Angelia