Part 1 of 2: Preparing everything on Power BI
First go to Power BI, this can easily be done from any Office on-line application.
Then, you will arrive in Power BI.
In Power BI the information received from ALSO IoT platform will need to be kept "somewhere". For this, go to "My Workspace", then "New" and then "Streaming Dataset".
For the New streaming dataset, select source of data "API" and then click on Next
Enter the Dataset name. Then, for the values (the information that will come from ALSO IoT Platform), to facilitate the learning process we strongly recommend to keep it simple and add 1 value of type Number and 1 value of type DateTime.
Then enable "Historic data analysis" and click on Create. The First Dataset is created !
The Dataset is created now. But how can it be used ? How can the information be sent to it is received on that dataset ? The answers appear here below.
How can that Dataset be reached ? The information should be sent to the URL mentioned (for the example here it is the URL that starts with https://api.powerbi.com/beta/95924808-3044-4177-9c1b-713746ffab95/datasets/... ...)
Which information can be sent and how exactly it should be sent ? For the example here "temperature" and "timestamp" can be sent using the format defined before. For temperature the type is defined Number so if the value "twenty" is sent it will not work, it has to be a number like 20. For timestamp is defined DateTime so if the value "9am" is sent it will not work, it has to be "2023-04-07T09:00:00.000Z". Also notice that a [ and a ] have to be included, at the beginning and at the end. If the information is not sent in the correct format, then Power BI will not be able to understand it and it will not be added to the dataset. If the information is not added to the dataset then it can not be used.
Having an incorrect format (in other words, not respecting the exact structure that has to be used) is by far in most of the cases why an user can have an issue with the integration. That's the reason why the exact format should be respected. Power BI makes the format very clear giving an example, as the one that appears below.
[
{
"temperature" :98.6,
"timestamp" :"2023-04-07T08:55:03.135Z"
}
]
Now that the importance of the exact format is clear, how can be actually sent the information ?
A very simple way to test this is using a tool called cURL.
cURL It is a command-line utility for transferring data to or from a server using various protocols such as HTTP, FTP, SMTP, etc. cURL is widely used for automating tasks that involve web APIs, testing RESTful web services, and downloading files from the internet. It is available on most operating systems, including Windows, macOS, and Linux.
Copy and paste the cURL code example from PowerBI below on a Notepad. Have a look at it for a moment, analyse it and see what is inside. You will see that this is a request type post (we want to send data), it has a json body (format of the data), values about temperature and timestamp are being sent with the correct format. Finally the corresponding URL (where the data will be sent) is also mentioned. Note how even the [ and the ] are also included. The example provided by Power BI is a perfect example and it will always work.
Now copy the code from the notepad and paste it on a command prompt or Terminal
Hit enter. A response from the PowerBI server will appear. Normally there should be a 200 indicating that all was Ok.
The first data has been sent to the dataset !
Go to the notepad, modify the only temperature value and the timestamp value, leave all the rest as it is. Copy all the code from the notepad and paste it on the Command Prompt or Terminal, hit enter. Repeat this a couple of times, with different values.
All the values sent to Power BI (the temperature values together with the corresponding timestamps were already received and stored in the dataset. But how can they be used ?
In Power BI, go back to "My Workspace" select the corresponding dataset and then "Create Report"
In case you see something different on the screen, make sure you select Lineage View. Is the most user friendly way to see everything.
Try some other visualisations. This can be done very simple. First select the table and then select the new visualisations.
Keep trying until you find the visual that you like, then click on Save.
The report will be saved with the given name.
Send new data to the dataset. To do this, go back to the notepad with the cURL code. Modify the values of temperature and timestamp, execute the code (on the Command Line or Terminal). Repeat this a couple of times. Remember that after the cURL code is executed, the response 200 should be there, indicating that all is Ok.
After the new values have been done, go back to your Power BI report and click on the refresh icon.
Part 2 of 2: Sending the data from ALSO IoT Platform to Power BI
To be completed after feedback is received on Part 1.
Comments
0 comments
Article is closed for comments.