I’ve hear this a lot in my presentations that “Does Power BI support real-time data?”, And I answer yes. In fact this feature was available long time ago with Azure Stream Analytics and Power BI, however recently some new changes happened in this area which allows Power BI dashboards to monitor real-time data changes on the dashboard from a data coming from API, and also PubNub. In this post I’ll show you how easy is to create a dashboard that shows real-time data coming from API. If you want to learn more about Power BI, read Power BI online book; from Rookie to Rock Star.
Real-Time Data, Instant Monitoring
One of the key features of monitoring tools is the ability to monitor the real-time data instantly when the data refreshes. That means as a user you don’t need to click on refresh button to see the latest data. This single key feature brings heaps of value to Power BI as a monitoring tool. This ability isn’t new, in fact Amir NetZ showed an awesome demo of an IoT device working with Azure Stream Analytics and Power BI as a real-time monitoring. So what is new is that we can now have this feature in the new generation of Power BI with a dashboard tile connected to streaming data. Streaming data sets can be now either API, Azure Stream Analytics (coming soon), and PubNub. More streaming services will come very soon I believe.
In this post I want to show you only streaming data through API, and showing that in a dashboard tile in Power BI. This single streaming option by itself opens many gates to Power BI as a real-time data monitoring tool. So let’s start.
For this example I will be using Microsoft sample .NET application named PBIRealTimeStreaming. You can download it from here.
You need Visual Studio (Not SSDT) for running this example solution.
Real-time Data Set
Start with logging in to Power BI service, create a new dashboard (or open an existing dashboard). And create a New Tile.
In the New Tile pane you now can see an option to add a tile for real-time data.
Select this option and click Next. if this is the first time you are using this service, then you probably don’t have any streaming data set existing there. So go to Manage Data to create one;
Now you are in streaming data sets window. you can see list of existing data sets, or create a new one with click on Add Streaming Dataset option on top right hand side.
Create Sample Streaming Data Set
As I’ve mentioned before at the time of writing this post only these three options for streaming data is available: API, Azure Stream Analytics, and PubNub (which is a data streaming service).
Because for this example we are using API as a streaming option, choose API and continue. Now create a new data set with a name such as mySampleRTDS or any other names you like. You have to create two columns as below;
- ts column with DateTime data type
- value column with Number data type
These are columns that will be created and passed through a .NET application through Power BI API to this data set.
Now click on create. This will create the data set with a Push URL that can be used in the application through API. copy this URL. We will be using that in the application next step.
Sample Streaming Data API Application
As I mentioned before, download the sample project. and then select the project under this path:
And open the PBIRealTimeStreaming solution in Visual Studio. This project creates a data set including a datetime value and a numeric value and will pass that through Power BI API (which will be discussed later in another post) to Power BI service.
Open Program.cs file and in line 33 change the value of realTimePushURL to the URL which we’ve copied from above step.
Run the application with pressing F5, or right click on project, Debug, Start New instance. The application will generate a data point in each second and send it through API.
Create Dashboard Tile
Now, let’s create the dashboard tile for this streaming data set. Follow the steps and choose the mySampleRTDS as the data streaming source for the tile.
There are number of charts/visualizations that you can use with streaming data set. Choose Card for the first example. and set the value of that to “value” data field
Add another dashboard tile for the same data set, and set this to be a Line chart with ts field in Axis, and value field in Values.
After adding each chart you will immediately see the real-time dashboard working and changes every second (because streaming data from application updates every second);
API Data Can Be Anything
The sample used here had only one datetime field and a value field. However you can create your own data stream from any event, notifications, or data set that you want to be monitored real time. With a simple application the stream of data can be generated. Or it can come from Azure Stream Analytics or PubNub. Don’t limit your options, think about where you can use this feature to solve a real-time monitoring challenge.