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

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

Reply
nbufff
Helper I
Helper I

DAX Error: Unsupported Media Type

Hi all, I'm trying to execute the query by using the REST API. It showed the error that Unsupported Media Type when I run below code. Is there any correction should be? Thanks for help!

 

let
body=" { 'queries': [ { 'query': 'EVALUATE SELECTCOLUMNS ('1#+SM+Missing+Region', '1#+SM+Missing+Region'[SKU]) } ], 'serializerSettings': { 'includeNulls': true } }",
Source = Json.Document(
Web.Contents(
"https://api.powerbi.com/v1.0/myorg/datasets/4cd14ac0-b612-48aa-980d-136d46a3e15c/executeQueries",
[
Headers=[Authorization="Bearer "&Token()],
Content=Text.ToBinary(body)
]
)
)
in
Source

1 ACCEPTED SOLUTION
lbendlin
Super User
Super User

You know you can do the same much simpler via the SSAS connector, right?

 

let
 Source=AnalysisServices.Database("powerbi://api.powerbi.com/v1.0/myorg/<workspace name", "<dataset name>", [Query="EVALUATE ...", Implementation="2.0"])
in
   Source

View solution in original post

4 REPLIES 4
nbufff
Helper I
Helper I

@lbendlin thanks for advise. Not sure how SAAS could get data from dataset since the data I need all from PBI dataset, could you pls help on it? Thanks.

I added the sample code.  Please try it out.

lbendlin
Super User
Super User

You know you can do the same much simpler via the SSAS connector, right?

 

let
 Source=AnalysisServices.Database("powerbi://api.powerbi.com/v1.0/myorg/<workspace name", "<dataset name>", [Query="EVALUATE ...", Implementation="2.0"])
in
   Source

YES. It works perfectly. Greatly Appreciate Your help!

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Prices go up Feb. 11th.

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

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