Check your eligibility for this 50% exam voucher offer and join us for free live learning sessions to get prepared for Exam DP-700.
Get StartedDon't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.
I am working on a process to extract data from Power BI datasets via the REST API
Datasets - Execute Queries - REST API (Power BI Power BI REST APIs) | Microsoft Docs
This works nicely and I can receive the resulting JSON fine, with the rows and columns of the result set coded as needed. However if the result set has blanks in some cells then the JSON will omit those properties (column values) for the affected rows.
{
"results": [
{
"tables": [
{
"rows": [
{
"[Week_Starting]": "12 Dec",
"[Report Date]": "2021-12-08T00:00:00",
"[Amount]": 14
},
{
"[Week_Starting]": "05 Dec",
"[Report Date]": "2021-12-08T00:00:00",
"[Amount]": 88
},
{
"[Report Date]": "2021-12-08T00:00:00",
"[Amount]": 52
},
{
"[Week_Starting]": "Previous",
"[Report Date]": "2021-12-08T00:00:00",
"[Amount]": 41
}
]
}
]
}
]
}
Note that the third row is missing the "[Week_Starting]" property as that data point is indeed BLANK in the Power BI Dataset.
Now I want to push that JSON result to a SQL server table. Unfortunately that server runs on compatibility level 110 so OPENJSON is not available. So my workaround was to ingest the JSON into a powershell PSObject
$rows = $res.Substring(3) | ConvertFrom-Json | Select-Object -Expand results | Select-Object -Expand tables | Select-Object -Expand rows
and then push that PSObject into the SQL table via
$rows | Write-SqlTableData -ServerInstance "server" -DatabaseName "detabase" -SchemaName "dbo" -TableName "table"
This works for all rows except for the row with the blank - it will not get imported.
I am looking for options to either replenish the missing property (for example by patching the PSObject) or to ingest the data anyway. I had thought about changing the DAX query but haven't been successful yet as that particular BLANK would require me to rewrite the entire data model.
Has anyone worked on this topic (fetching query results into SQL Server table) yet?
Solved! Go to Solution.
Hey @lbendlin ,
I'm wondering if you have considered the property "DatasetExecuteQueriesSerializationSettings"
Datasets - Execute Queries - REST API (Power BI Power BI REST APIs) | Microsoft Docs
Regards,
Tom
Hey @lbendlin ,
I'm wondering if you have considered the property "DatasetExecuteQueriesSerializationSettings"
Datasets - Execute Queries - REST API (Power BI Power BI REST APIs) | Microsoft Docs
Regards,
Tom
D'oh. "Wer lesen kann, ist klar im Vorteil."
Thank you.
Hey @lbendlin ,
I wasn't aware of your perfect German 😉
Frohe Weihnachten!
Regards,
Tom
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.
User | Count |
---|---|
22 | |
17 | |
10 | |
8 | |
8 |
User | Count |
---|---|
37 | |
28 | |
18 | |
17 | |
14 |