Power Platform | Ah, yes. The mighty Power Platform in which your imagination is usually the biggest obstacle. Today my creativity stretches from Twitter to Power Automate and into Power BI. The best part of this blogpost is that you can do this yourself and it’ll take less than 15 minutes. Promise! (Might need Power BI Pro, but who could live without that anyway?).
If you want to skip right to my results, just click on the picture here to get redirected to my published Power BI report.
What are we even doing today and why??
We’ll be creating our own real time stream of tweets into a Power BI Report! Well, real time being of by up to 30 minutes or so as it takes some time from a tweet is published before it’s triggering Power Automate.
We’ll be doing it because it’s possible. Simple as that!
Create a Power BI Streaming Dataset
Head into powerbi.com, login and choose your workplace! For this, I’ve simply created in my own workspace.
Go to “Create” in the top right corner and choose Streaming Dataset.
Go with API and just hit Next.
Name your dataset something fancy and name a few fields. One will be a number and hold the amount of tweets while the others will hold different kind of date fields.
(For streaming datasets, you can’t create new columns in DAX in Power BI, that’s why I create them in the dataset from the beginning).
If you don’t select the “Historic data” you will only keep your data for 1 hour. Perfect if you just want current data, like last hour trends of how many people who’ve passed through a door or amounts of calls to the servicedesk.
That’s it folks! You’ve created your own streaming dataset. If you’re fluent in PowerShell, you have some code ready down below.
If you’re like me, and prefer codeless, we’ll head into Power Automate for our magic!
Getting the tweets
Create a new Flow in Power Automate that triggers by a new tweet.
You may want to use a more active account than mine or you might want to use the hashtag for your company. You can of course use several as well to get some more data in there.
Next step – Add row to a Dataset.
Choose your dataset in the lists. When done, you’ll be presented with your fields from the dataset.
Allright, fill in what you want in each field. I’ve been using expressions here to get weeks, month and so on.
Copy with pride!
formatDateTime(triggerBody()?[‘CreatedAtIso’] , ‘yyyy-MM-dd’ )
formatDateTime(triggerBody()?[‘CreatedAtIso’] , ‘yyyy-MM-dd HH:mm’ )
formatDateTime ( triggerBody()?[‘CreatedAtIso’] , ‘yyyy’ )
div ( dayOfYear ( triggerBody()?[‘CreatedAtIso’] ) , 7 )
formatDateTime(triggerBody()?[‘CreatedAtIso’], ‘MM’) – formatDateTime(triggerBody()?[‘CreatedAtIso’] , ‘MMMM’ )
Ladies and gentlemen. We have now officially started filling up our Streaming Dataset with information! Please take a moment to appreciate how simple this was before moving on.
Creating your Power BI Report
Finally we’re heading into the comfort of Power BI Desktop. If you haven’t installed it (haha, who doesn’t have Power BI Desktop installed?), you can download it from Microsoft Store.
When you start the program, login using your Office 365 account. Then just click “Get Data” in the left corner.
Search for Power BI and select Power BI Dataset from the list. Click Connect.
You’ll get a list of all your datasets and since I assume you have several hundreds, searching is a good idea. Click on your dataset and hit OK.
That’s pretty much it! Now it’s just a matter of moving our data onto the workspace and create some magic!
Hope this inspired you to try out streaming datasets! Feel free to reach out and tell me if you build something awesome out of this.
And if you get stuck, I’m of course available to assist. Cheers!