# Data explorer - Power BI

**URL:** https://meta.discourse.org/t/data-explorer-power-bi/215822
**Category:** Development
**Created:** [January 24, 2022, 3:08pm UTC](https://meta.discourse.org/t/data-explorer-power-bi/215822 "2022-01-24T15:08:27Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![Amine\_Akkar](https://avatars.discourse-cdn.com/v4/letter/a/dfb087/32.png) [@Amine\_Akkar](https://meta.discourse.org/u/Amine_Akkar)
#### Post date: [January 24, 2022, 3:08pm UTC](https://meta.discourse.org/t/data-explorer-power-bi/215822/1 "2022-01-24T15:08:27Z")

</div>

Hello,  
I’m using the following code to call data from [Data Explorer](https://meta.discourse.org/t/32566?silent=true) to PBI through API

> (queryID) =\> let  
> resultCount = 10000,  
> otherNameForPage = 0,
> 
> ```
> GetPage = (otherNameForPage) =>
> let
> content1 = "params={""page"":""" & Number.ToText(otherNameForPage) & """}",
> RawData = Json.Document(Web.Contents(
> "https://forum.xxxxxx.com/admin/plugins/explorer/queries",
> [RelativePath=Number.ToText(queryID) & "/run",
> Query=
> [
> params="{""page"":""" & Number.ToText(otherNameForPage) & """}"
> ],
> 
> Headers = [ 
> #"api-username"="xxxxxxxx",
> #"api-key"="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
> #"Content-Type" = "application/x-www-form-urlencoded"],
> Content = Text.ToBinary(content1)
> ]
>                 
> ) ),
> resultCount = RawData[result_count]
> in
> if RawData[result_count] = 0 then null else RawData,
> Pages = List.Generate(
> () => [i = 0, RawData = GetPage(i)],
> each [RawData] <> null,
> each [i=[i]+1, RawData = GetPage(i)],
> each Table.Combine(let raw = [RawData] in List.Transform(raw[rows], each Table.FromRows({_}, raw[columns])))),
> Output = Table.Combine(Pages)
> 
> ```
> 
> in  
> Output

I was able to load data from query that contain this code :

> –[params]  
> – integer :page = 0
> 
> select users.id, users.username, user\_custom\_fields.value from users, user\_custom\_fields  
> where users.id = user\_custom\_fields.user\_id and user\_custom\_fields.name =‘user\_field\_1’
> 
> OFFSET :page \* 10000  
> LIMIT 10000

but when I call another report that contains the following query

```plaintext
SELECT
  user_id,
  COUNT(*) AS visits
FROM user_visits
WHERE visited_at > CURRENT_DATE - 30
GROUP BY 1
ORDER BY 2 DESC

```

it returns **422 : Unprocessable Entity**  
( it take much time before returning this error)

Is it possible to fix it?

---

<div class="post-metadata">

### Author: ![Falco](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/falco/32/179432_2.png) [@Falco](https://meta.discourse.org/u/Falco)
#### Post date: [January 24, 2022, 3:14pm UTC](https://meta.discourse.org/t/data-explorer-power-bi/215822/2 "2022-01-24T15:14:11Z")

</div>

Does that query runs on the [Data Explorer](https://meta.discourse.org/t/32566?silent=true) UI? If it works there, but not on your PowerBI integration the problem lies elsewhere from Discourse.

---

<div class="post-metadata">

### Author: ![Amine\_Akkar](https://avatars.discourse-cdn.com/v4/letter/a/dfb087/32.png) [@Amine\_Akkar](https://meta.discourse.org/u/Amine_Akkar)
#### Post date: [January 24, 2022, 3:17pm UTC](https://meta.discourse.org/t/data-explorer-power-bi/215822/3 "2022-01-24T15:17:02Z")

</div>

@Falco, that right, the report works instantly in [Data Explorer](https://meta.discourse.org/t/32566?silent=true) UI

---

<div class="post-metadata">

### Author: ![Amine\_Akkar](https://avatars.discourse-cdn.com/v4/letter/a/dfb087/32.png) [@Amine\_Akkar](https://meta.discourse.org/u/Amine_Akkar)
#### Post date: [January 24, 2022, 3:59pm UTC](https://meta.discourse.org/t/data-explorer-power-bi/215822/4 "2022-01-24T15:59:48Z")

</div>

> [@Amine\_Akkar](#):
>
> 422 : Unprocessable Entity

Was looking for the source for the error, I found this description :  
`The HyperText Transfer Protocol (HTTP) **`422 Unprocessable Entity`** response status code indicates that the server understands the content type of the request entity, and the syntax of the request entity is correct, but it was unable to process the contained instructions.`  
it seems to come from the server ? no ?
