Forum Discussion
Workspace, semantic model, report, users and dataset lifecycle management
- 4 months ago
palamanb_Risk appriciated to help you. Here are the outlined steps to do the same.
1) Copy the attached .MEZ file on C:\Users\MagnusMinds\Documents\Power BI Desktop\Custom Connectors folder on your machine.
2) Open power bi desktop and do this setting and restart the power bi. (This is a setting to use the custom connectors)
3) Open power bi and clcik get data -> search for custom or any relevent text
4) After click it ask you to allow third party connectors.
5) It list the available API endpoint in a form of function you can use whatever you need
6) Load data and build the dahboard/report as your own. Then below are the steps for the gateway setup and refresh same report on the service on schdule basis.
Add the custom connector folder here in the connectors section.
create the gateway on the service using this connector use it in the semantic model as well.
I hope this helps! If this resolves your issue, please mark this as the Accepted Solution to help others.
Note: Try to do in the hierarchy like (workspace\group -> Dataset -> Report etc....) As the respective function need the parent as a parameter.
Thanks for the intrest on helping me , unfortunately , I am not able to download the file from the drive . Can you please help to check other way to download the file.
Thanks
- Lodha_Jaydeep4 months agoSolution Sage
palamanb_Risk, while calling the function in the power query, are you getting the table populated or not?
Can you confrom if you are able to load the table in the power query mode?
You should apply the query tranformation in the below orer to get this working correctly. You can add/remove the steps as your need. Use the below queires it's working for me in my report.
1) Load all the workspaces/groups: Is inital to laod this table to get other table populated.let Source = GetWorkspace(null, null, null), #"Parsed JSON" = Json.Document(Source), value = #"Parsed JSON"[value], #"Converted to Table" = Table.FromList(value, Splitter.SplitByNothing(), null, null, ExtraValues.Error), #"Expanded Column1" = Table.ExpandRecordColumn(#"Converted to Table", "Column1", {"id", "isReadOnly", "isOnDedicatedCapacity", "capacityId", "defaultDatasetStorageFormat", "type", "name"}, {"id", "isReadOnly", "isOnDedicatedCapacity", "capacityId", "defaultDatasetStorageFormat", "type", "name"}), #"Changed Type" = Table.TransformColumnTypes(#"Expanded Column1",{{"id", type text}}), #"Renamed Columns" = Table.RenameColumns(#"Changed Type",{{"id", "WorkspaceID"}, {"name", "WorkspaceName"}}) in #"Renamed Columns"2) GetGroupUsers (Workspace user)
// let // Source = GetGroupUsers(null) // in // Source let // Assume your table is called "SourceTable" and has columns "WorkspaceID" and "DatasetID" SourceTable = GetAllWorkspace, // Replace with your actual table name // Function to get datasets for each workspace GetWorkspaceUserInfo = (workspaceID as text) => try GetGroupUsers(workspaceID) otherwise null, // Add a new column to the table that calls the GetWorkspaceUserInfo function for each row AddDatasetInfo = Table.AddColumn( SourceTable, "WorkspaceUserInfo", each GetWorkspaceUserInfo([WorkspaceID]) ), #"Removed Columns" = Table.RemoveColumns(AddDatasetInfo,{"isReadOnly", "isOnDedicatedCapacity", "capacityId", "defaultDatasetStorageFormat", "type", "WorkspaceName"}), #"Parsed JSON" = Table.TransformColumns(#"Removed Columns",{{"WorkspaceUserInfo", Json.Document}}), #"Expanded WorkspaceUserInfo" = Table.ExpandRecordColumn(#"Parsed JSON", "WorkspaceUserInfo", {"@odata.context", "value"}, {"@odata.context", "value"}), #"Expanded value" = Table.ExpandListColumn(#"Expanded WorkspaceUserInfo", "value"), #"Expanded value1" = Table.ExpandRecordColumn(#"Expanded value", "value", {"groupUserAccessRight", "displayName", "identifier", "principalType", "emailAddress"}, {"groupUserAccessRight", "displayName", "identifier", "principalType", "emailAddress"}) in #"Expanded value1"For laoding any dataset related table you need to load the datasets first using below query.
let // Assume your table is called "SourceTable" and has columns "WorkspaceID" and "DatasetID" SourceTable = GetAllWorkspace, // Replace with your actual table name // Function to get datasets for each workspace GetDatasetInfo = (WorkspaceID as text) => try GetDatasetsInGroup(WorkspaceID) otherwise null, // Add a new column to the table that calls the GetDatasetInfo function for each row AddDatasetInfo = Table.AddColumn( SourceTable, "DatasetInfo", each GetDatasetInfo([WorkspaceID]) ), #"Removed Columns" = Table.RemoveColumns(AddDatasetInfo,{"isReadOnly", "isOnDedicatedCapacity", "defaultDatasetStorageFormat", "type"}), #"Parsed JSON" = Table.TransformColumns(#"Removed Columns",{{"DatasetInfo", Json.Document}}), #"Expanded DatasetInfo" = Table.ExpandRecordColumn(#"Parsed JSON", "DatasetInfo", {"@odata.context", "value"}, {"@odata.context", "value"}), #"Expanded value" = Table.ExpandListColumn(#"Expanded DatasetInfo", "value"), #"Expanded value1" = Table.ExpandRecordColumn(#"Expanded value", "value", {"id", "name", "webUrl", "addRowsAPIEnabled", "configuredBy", "isRefreshable", "isEffectiveIdentityRequired", "isEffectiveIdentityRolesRequired", "isOnPremGatewayRequired", "targetStorageMode", "createdDate", "createReportEmbedURL", "qnaEmbedURL", "upstreamDatasets", "users", "queryScaleOutSettings"}, {"id", "name", "webUrl", "addRowsAPIEnabled", "configuredBy", "isRefreshable", "isEffectiveIdentityRequired", "isEffectiveIdentityRolesRequired", "isOnPremGatewayRequired", "targetStorageMode", "createdDate", "createReportEmbedURL", "qnaEmbedURL", "upstreamDatasets", "users", "queryScaleOutSettings"}), #"Expanded upstreamDatasets" = Table.ExpandListColumn(#"Expanded value1", "upstreamDatasets"), #"Expanded users" = Table.ExpandListColumn(#"Expanded upstreamDatasets", "users"), #"Expanded queryScaleOutSettings" = Table.ExpandRecordColumn(#"Expanded users", "queryScaleOutSettings", {"autoSyncReadOnlyReplicas", "maxReadOnlyReplicas"}, {"autoSyncReadOnlyReplicas", "maxReadOnlyReplicas"}), #"Renamed Columns" = Table.RenameColumns(#"Expanded queryScaleOutSettings",{{"id", "DatasetID"}, {"name", "DatasetName"}}), #"Filtered Rows" = Table.SelectRows(#"Renamed Columns", each ([DatasetID] <> "e0ae1bcc-eff7-46ee-adec-e14ae34cf843")) in #"Filtered Rows"GetDatasetUsersinGroup (Below is for your reference only. It's for GetDataSourceByDataset) In a same way you need to do for the GetDatasetUsersinGroup to load the table.
// let // // Assume your table is called "SourceTable" and has columns "WorkspaceID" and "DatasetID" // SourceTable = GetAllDatasetByWorkspace, // Replace with your actual table name // // Function to get data sources for each workspace and dataset // GetDatasourceInfo = (WorkspaceID as text, DatasetID as text) => // try // GetDatasetDatasourcesInGroup(WorkspaceID, DatasetID) // otherwise // "", // // Add a new column to the table that calls the GetDatasourceInfo function for each row // AddDatasourceInfo = Table.AddColumn( // SourceTable, // "DatasourceInfo", // each GetDatasourceInfo([WorkspaceID], [DatasetID]) // ), // #"Removed Columns" = Table.RemoveColumns(AddDatasourceInfo,{"@odata.context", "webUrl", "addRowsAPIEnabled", "configuredBy", "isRefreshable", "isEffectiveIdentityRequired", "isEffectiveIdentityRolesRequired", "isOnPremGatewayRequired", "targetStorageMode", "createdDate", "createReportEmbedURL", "qnaEmbedURL", "upstreamDatasets", "users", "autoSyncReadOnlyReplicas", "maxReadOnlyReplicas"}), // #"Parsed JSON" = Table.TransformColumns(#"Removed Columns",{{"DatasourceInfo", Json.Document}}), // #"Expanded DatasourceInfo" = Table.ExpandRecordColumn(#"Parsed JSON", "DatasourceInfo", {"@odata.context", "value"}, {"@odata.context.1", "value"}), // #"Expanded value" = Table.ExpandListColumn(#"Expanded DatasourceInfo", "value"), // #"Expanded value1" = Table.ExpandRecordColumn(#"Expanded value", "value", {"datasourceType", "connectionDetails", "datasourceId", "gatewayId"}, {"datasourceType", "connectionDetails", "datasourceId", "gatewayId"}), // #"Expanded connectionDetails" = Table.ExpandRecordColumn(#"Expanded value1", "connectionDetails", {"server", "database"}, {"server", "database"}) // in // #"Expanded connectionDetails" let // Assume your table is called "SourceTable" and has columns "WorkspaceID" and "DatasetID" SourceTable = GetAllDatasetByWorkspace, // Replace with your actual table name // Function to get data sources for each workspace and dataset with null handling GetDatasourceInfo = (WorkspaceID as nullable text, DatasetID as nullable text) => try if WorkspaceID <> null and DatasetID <> null then GetDatasetDatasourcesInGroup(WorkspaceID, DatasetID) else null otherwise null, // Add a new column to the table that calls the GetDatasourceInfo function for each row AddDatasourceInfo = Table.AddColumn( SourceTable, "DatasourceInfo", each GetDatasourceInfo([WorkspaceID], [DatasetID]) ), // Remove unnecessary columns #"Removed Columns" = Table.RemoveColumns(AddDatasourceInfo, { "@odata.context", "webUrl", "addRowsAPIEnabled", "configuredBy", "isRefreshable", "isEffectiveIdentityRequired", "isEffectiveIdentityRolesRequired", "isOnPremGatewayRequired", "targetStorageMode", "createdDate", "createReportEmbedURL", "qnaEmbedURL", "upstreamDatasets", "users", "autoSyncReadOnlyReplicas", "maxReadOnlyReplicas" }), // Parse JSON in the DatasourceInfo column, ensuring null handling #"Parsed JSON" = Table.TransformColumns(#"Removed Columns", { {"DatasourceInfo", each if _ <> null then Json.Document(_) else null} }), // Expand the DatasourceInfo record #"Expanded DatasourceInfo" = Table.ExpandRecordColumn(#"Parsed JSON", "DatasourceInfo", {"@odata.context", "value"}, {"@odata.context.1", "value"} ), // Expand the value list #"Expanded value" = Table.ExpandListColumn(#"Expanded DatasourceInfo", "value"), // Expand the records within the value column #"Expanded value1" = Table.ExpandRecordColumn(#"Expanded value", "value", {"datasourceType", "connectionDetails", "datasourceId", "gatewayId"}, {"datasourceType", "connectionDetails", "datasourceId", "gatewayId"} ), // Expand the connectionDetails record with null handling #"Expanded connectionDetails" = Table.ExpandRecordColumn(#"Expanded value1", "connectionDetails", {"server", "database"}, {"server", "database"} ) in #"Expanded connectionDetails"Hope this helps. let me know if you need anyhting else.
- Lodha_Jaydeep4 months agoSolution Sage
Hi palamanb_Risk,
Hope you are doing good. Did you get a chnace to test these queires if any luck for you? Feel free to reach out in case of any issues.Thanks,
- Lodha_Jaydeep4 months agoSolution Sage
Hi palamanb_Risk,
Do you have any updates on this? If you are able to load the data or not!