Page 1 of 1

Connect to Power BI using TM1 Rest api

Posted: Fri Jan 17, 2020 8:13 am
by kavitha2002
Hello Everyone,

In Power BI, I have tried the with Rest api MDx query.

In GetData -> web-> in Advancced option, gave RestapiUrl to fetch the Dimension Element. It Worked well and pull the elemnts from TM1 with the 'GET' Request.

Now am trying with MDX POST request to fetch the cube data. AS I am new to power BI, I just want to know how the cube data looks in PowerBI.
But in fiddler it shows below error, contentType not supported. In ARC/POSTMan same is working fine.

My try: I gave contentType as application/json also. But same error.
fiddler.png
fiddler.png (34.89 KiB) Viewed 5154 times
Kindy provide your ideas/suggestions. Thanks.

Re: Connect to Power BI using TM1 Rest api

Posted: Fri Jan 17, 2020 9:30 am
by David Usherwood
In your earlier thread https://www.tm1forum.com/viewtopic.php?f=3&t=15092 I and others said you should use TM1PY, since PowerBI can execute Python. IMO that is the best way forward unless you pony up for one of the many middleware products which do this job rather well.

Re: Connect to Power BI using TM1 Rest api

Posted: Fri Jan 17, 2020 9:41 am
by kavitha2002
Yes true, I agree. But I am trying with TM1 Rest api with Web Connector. Just as a POC.

Re: Connect to Power BI using TM1 Rest api

Posted: Fri Jan 17, 2020 4:10 pm
by ascheevel
Do you get the same error if you just pass "application/json" as the content type header instead of "application/json; charset=utf-8"?

Re: Connect to Power BI using TM1 Rest api

Posted: Sun Jan 19, 2020 3:01 pm
by kavitha2002
I have tried "application/json" as well, but end up with the same error.

Re: Connect to Power BI using TM1 Rest api

Posted: Mon Jan 27, 2020 7:29 am
by kavitha2002
I have changed the Power BI syntax for the MDX query. Now query working well.

For the future reference, I am leaving the working query below.

let
url = "http://localhost:8000/api/v1/ExecuteMDX ... nal,Value)",
body = "{
""MDX"": ""SELECT {[}zPBI_Account].Members} on 0, {[}zPBI_Country].Members} on 1 FROM [zPBI_SalesCube] WHERE ([}zPBI_Model].[Model1], [}zPBI_Month].[J01])""
}",

Source = Json.Document(Web.Contents(url, [Headers=[#"Authorization"="Basic fasff", #"Content-Type"="application/json"]

])),
#"Source"
in