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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
nssidhu
Frequent Visitor

Load Multi level Hierarichal JSON file and setup relation with 3 & 4th Level and other entity

[
{
    "UserId": "b27494d7-e1e4-4dff-a22e-0c2974880bf2",
    "id": "cb0c8a63-d379-4208-a661-0040ae737bf4",
    "tipSecurableSet": {
        "id": "c11b7397-52f5-4d5d-ae01-9843a3cc0d53",
        "Clients": [
            {
                "@odata.type": "#Deloitte.TiPAA.Common.DTOs.TipSecurableSetItemDto",
                "typeId": "062d239d-6edf-447e-8580-e87e27cf028c",
                "Entityids": [
                    "fd225adc-dfcd-4324-bceb-496a36cc5412",
                    "fd225adc-dfcd-4324-bceb-496a36cc5413",
                    "fd225adc-dfcd-4324-bceb-496a36cc5414"
                ],
                "Clientid": "3cd0091b-8779-4241-9fb2-ff4d84807e04"
            },
            {
                "@odata.type": "#Deloitte.TiPAA.Common.DTOs.TipSecurableSetItemDto",
                "typeId": "53e7b8e2-6d90-42e8-8a42-2279141b33c6",
                "Entityids": [
                    "7615cbcf-0db8-4040-9791-0d7e15744009",
                    "7615cbcf-0db8-4040-9791-0d7e15744010",
                    "7615cbcf-0db8-4040-9791-0d7e15744011",
                ],
                "Clientid": "18b17e67-1853-40b3-b177-36a21653c947"
            }
        ]
    }
},
{
    "UserId": "ff28a178-356f-46c8-b746-6d9e23329313",
    "id": "4ea7aeb4-be41-4244-98ac-005a93214d63",
    "tipSecurableSet": {
        "id": "58243b5f-2048-4ee0-b5a6-a15b97618265",
        "Clients": [
            {
                "@odata.type": "#Deloitte.TiPAA.Common.DTOs.TipSecurableSetItemDto",
                "typeId": "53e7b8e2-6d90-42e8-8a42-2279141b33c6",
                "Entityids": [
                    "e3e481c5-ae28-44af-8503-8084526183a8",
                    "60898bcd-ad07-442f-8546-9175d077d9d0"
                ],
                "Clientid": "2c0c448a-7e15-4d97-9719-e58a6fb2bb3c"
            },
            {
                "@odata.type": "#Deloitte.TiPAA.Common.DTOs.TipSecurableSetItemDto",
                "typeId": "062d239d-6edf-447e-8580-e87e27cf028c",
                "Entityids": [
                    "e7fa324b-0046-4317-8616-84eb095e1ae6"
                ],
                "Clientid": "1c43257f-622a-46f6-b732-247b3c84a414"
            }
        ]
    }
}


]

I already have Clients and entities separately so want to setup relation with those existing entity both ways so that we once select client we can see which users are assigned to that client and what entities they have associated.

 

Similarly, when we select user, we want to see which client they have access to and which entities under that client they have access to.

I am very new to Power BI, so detailed steps are appreciated.

1 ACCEPTED SOLUTION
v-huizhn-msft
Microsoft Employee
Microsoft Employee

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.

1.PNG

Please click To table, and expanded the column by clicking the button highlighted in yellow background.

2.PNG

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"}, {"Column1.tipSecurableSet.Clients.@odata.type", "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.

1.PNG

>>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.

1.PNG

If you have any other issue, please feel free to ask.

Best Regards,
Angelia

View solution in original post

1 REPLY 1
v-huizhn-msft
Microsoft Employee
Microsoft Employee

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.

1.PNG

Please click To table, and expanded the column by clicking the button highlighted in yellow background.

2.PNG

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"}, {"Column1.tipSecurableSet.Clients.@odata.type", "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.

1.PNG

>>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.

1.PNG

If you have any other issue, please feel free to ask.

Best Regards,
Angelia

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.