PowerBI in the browser is an easy and fast reporting service which is a great addition to Azure IoT. In just minutes you can build charts and dashboards.
I demonstrated this in part 3 of this series of blogs about implementing IoT in Azure.
But I was missing the ‘sliding behaviour’, the charts I created showed all telemetry. And with all I mean from the very first telemetry passed to the latest one.
In this blog, I will show you how to tweak the dashboard a little bit to get that real-time behaviour of showing only the data of the past hour, day or 10 minutes.
This is part 5 of a series of blogs about IoT Hub communication using UWP:
- Part 1: A very simple complex IoT Hub example
- Part 2: Using the Visual Studio 2015 IoT Hub Extension and IoT Hub Device explorer
- Part 3: Adding the power of BI to your IoT Hub
- Part 4: Closing the Windows IoT Core feedback loop using Azure Functions
- Part 5: PowerBI showing telemetry of past ten minutes, always!
- Part 6: Add more flexibility to StreamAnalytics
To start with PowerBi where we left if last time, here is a chart showing, the temperature over time (And some columns called device name, Lumen and Baselumen; ignore them 🙂 ).
As you can see, the chart is showing telemetry from various presentations and some research I have done. So there are big gaps in there. I’m only interested in the last part.
But in the dashboard, it’s all squeezed:
I looked around for settings to filter the output with a gliding starting date (like last 24 hours instead of time greater dan yesterday; and yesterday is an ‘dd-mm-yyyy’ notation).
But then I looked at the “Ask a question about your data”:
If you click that line, a ‘wizard’ will start:
Some suggestions are made about columns. But I select the whole table ‘various’:
After entering the table name, a suggestion is made. This is nice: natural language! So I tried to get the data of the past day (one day):
And that works, it filters the data. But the line at the bottom says it show all data of yesterday. That’s odd. Let’s try the last 10 minutes:
I have not passed any data recently so the table is empty. But the line at the bottom shows: From 10 minutes before now to last minute!
Nice, it works!
But how can I update my dashboard? Going back removed my selection. In fact, this is a new chart (a grid actually), so we create a new chart with this filter:
- change the grid into a ‘line and clustered chart’
- put the temperature in the Column values
- put lumen and baselumen in Line values
- put time in Shared axis
- remove the devicename (if available)
- Pin visual (in the existing dashboard)
So now we have a second chart, still empty (I have not added telemetry for the past ten minutes):
let’s add some telemetry and see what happens…
So there it is. On the left, we see the original charts and on the right the now ‘sliding’ one. Although a lot of telemetries is coming in, it is barely visible at the left. But on the right, we see the chart filled with telemetry for the first ten minutes and then it starts to ‘forget’ the oldest telemetry. So it works!
Try it out for yourself and keep in mind to check the explanation at the bottom of the ”wizard”.