Help to connect InfluxDB with PowerBI

Hello, can someone help connect PowerBI to influxdb.

I am trying with WEB connector from PowerBI, and i receive data for example for this command:
http://localhost:8087/health

but i can´t query a bucket data, can you help me? thanks

Welcome @BRIOOOSA

Is your goal to store the PowerBI data in InfluxDB? What is the type and format of data is received from the command (URL)?

Hi grant1,

No, my goal it’s to get data from InfluxDB 2.6 that i have running in a docker container.
and i want to query from PowerBI to influxDB.

I think the only option you have is to use the WebConnector with InfluxDB API

Now, I am looking on how to write data from Power Bi to InfluxDB but a couple of months ago I wanted to query data from InfluxDB to power BI.

I managed to accomplish the later thanks to the example on this post : Sharing: Example Power BI Power Query to execute Flux query - InfluxDB 2 - InfluxData Community Forums

late but hope it helps you too.

1 Like

Well @fercasjr thank you so much. This realy help me. It realy works.

I am a total beginner and do not understand the documentation. what should I do to query an Influxdb to PowerBI?
I tried to set the WebConnector like this:

The connection did not work and I am not sure where to put the query. Can anybody help?

you can’t do it like that.

I don’t remember exactly where but you need to create a “custom” connection using the advanced query editor.

I found the mail that I sent to a college (I don’t have access to the power BI stuff but back then we were able to make it work) .

To be able to execute queries from InfluxDB on power BI we should be able to use the REST API: Query with the InfluxDB API | InfluxDB Cloud Documentation (influxdata.com)

And supposedly we can pass the extra parameters needed to power BI using the “Advanced editor” Query overview in Power BI Desktop - Power BI | Microsoft Learn

here is an some example M-code to pull data through the Influx api using the webconnector. Open a blank query, open the advanced editor and paste this code into it. Edit the details for your connection:

let 
// // // 
// inputs
// // // 
    influx_org = "<YOUR_INFLUX_ORG>"

  , influx_uri = "<YOUR_INFLUX_URI>"

  , influx_uri_path = "api/v2/query"

  , influx_token = "<YOUR_INFLUX_API_KEY>"


// THIS WILL RETURN THE LAST 24Hrs

  , influx_query = Text.ToBinary("
from(bucket: ""<YOUR_INFLUX_BUCKET>"")
  |> range(start: -24h)
  |> filter(fn: (r) => r[""_measurement""] == ""<YOUR_MEASUREMENT_NAME>"") 
  |> filter(fn: (r) => r[""_field""] == ""<YOUR_FIELD_NAME>"") 
  |> yield()
    ")

// // // 
// work
// // // 

//************************************LEAVE EVERY THING BELOW THIS ALONE**************************


  , req_headers = [ Authorization = Text.Combine({"Token ", influx_token})
                  , #"Content-Type" = "application/vnd.flux" ]

  , req_options = [ Headers = req_headers
                  , RelativePath = influx_uri_path
                  , Query = [ org = influx_org ]
                  , Content = influx_query ]

  , res_content = Web.Contents(influx_uri, req_options)
in
    res_content

thanks a lot. The script seems to work.
Unfortunately there seems to be some rights issues:

using the exact same credentials Grafana is able to connect.

Any ideas?

edit: after reading a bit across the net there may be an issue with SSL authentification. Does Power BI need SSL?

PowerBI doesn’t support SSL. Without knowing more about your current architecture I can’t recommend any solutions. this query is still working for a local deployment. You could push your data to the cloud and access through the api there.

PS: You should block out your IP address when posting.

PowerBI doesn’t support SSL

Fine with me. As I am within my network Iwouldn’t use SSL.

Without knowing more about your current architecture I can’t recommend any solutions

I tried to describe my architecture at least for a basic understanding. What are the stats I should share?

this query is still working for a local deployment

this is exactly what I am searching for, but it does not work with my local network.

You could push your data to the cloud and access through the api there.

I dont want to do that.

What permissions are you using for the data source settings?

The token used has full read and write access

I am a bit helpless. Are there any ideas on how to corner my mistake?

I still dont know if my error lies within Power BI, the database, the docker container or the network.

Is there any free Windows application which can query InfluxDB so that I can check my connectivity and credentials?

you could use CURL commands on the command prompt in windows to execute and test your queries.

Now I tried to understand / learn cURL, but ending up with additional questions.
Query-Tools like for SQL (as MySQL Workbench) do not exist for InfluxDB?

I tried:

curl --request POST http://192.XXX.XXX.XXX:8086/api/v2/query?orgID=orgid --header 'Authorization: Token 4faajkgkafgalkjcxhgawk2x38fn8n8bvrli86blki786bl86bpo9896==' --header 'Accept: application/csv' --header 'Content-type: application/vnd.flux' --data 'from(bucket:"bucket")'

and got:

curl: (7) Failed to connect to 192.XXX.XXX.XXX port 8086 after 2040 ms: Couldn't connect to server

Port should be correct:

I seem to have a very general problem with my container - right?

Hello @Kevin_T,
We’re currently working on a powerbi integration for InfluxDB v3. It should be available shortly.

1 Like

Hi @Anaisdg,
Do you have an update on how far you have come with the PowerBI integration? And can you already give an estimate on when we can expect this?