What if you need to present real-time data in a Power BI dashboard?
In this post I will give you an overview of two different approaches to address the requirements for real-time reporting.
Power BI Streaming
First and easier option is to create a Streaming dataset in Power BI, and then write some small code to push data directly into this dataset.
Notes & Limitations:
With “historic data analysis” option ON, data will be retained forever and available on reports and alerts from dashboard tiles. Rows can also be removed using the API.
With “historic data analysis” option OFF, data will not be retained, and Power BI will keep up to 200k rows, FIFO.
120 POST rows requests per minute.
Azure Stream Analytics
Another option is to use Azure and then ingest data via Events Hub.
Output will be the Power BI dataset “cbiStreamAnalytics”.
And the code?
Simple! A console C# application is the easiest way to test and push data to both datasets.
// Push to Power BI
var postToPowerBi = HttpPostAsync(measureTypeItem.powerBiPostUrl, "[" + jsonString + "]");
// Push to Azure Stream Analytics
EventHubClient client = EventHubClient.CreateFromConnectionString(ConnectionStringStreamAnalytics, "cbistreaminghubpbi");
client.Send(new EventData(Encoding.UTF8.GetBytes(jsonString)));
Result
Here is an example of a Power BI dashboard showing real-time data from both datasets to compare latency.