Modeling Wuhan Coronavirus (2019-nCoV) Global Cases Dashboard with Power BI — Part 2
In my earlier post, we have used the set of data provided by Johns Hopkins University Center for Systems Science and Engineering (JHU CSSE) and built a tracking dashboard using Power BI. With some tweaks using Power Query, we are able to pull the sheet with the latest data and reflect it on Power BI.
In this short post, I will share on publishing the Power BI file together with the data set and setting data refresh schedule.
Publishing the file to Power BI Service
After finishing the Power BI file on Power BI Desktop, you can publish it to Power BI Service. When you publish, you also publish the data in the model to your Power BI workspace.
Before publishing to Power BI Service, you need a Power BI Pro subscription. A Power BI Pro license enables a user to collaborate with other Power BI Pro users by consuming content from, and sharing content with other users with a Power BI Pro license. Only users with a Power BI Pro license can publish content to app workspaces, share dashboards, and subscribe to dashboards and reports. You can refer to this link for Power BI services features by license type.
Workspace is the place to collaborate with colleagues to create collections of dashboards, reports, and paginated reports. Then you can bundle that collection into an app and distribute it to your whole organization, or to specific people or groups.
Navigate to the Publish button on the Home tab in Power BI desktop.
Once you select the Publish, all your visuals, custom measures and reports are all packaged and published to Power BI service. Power BI files have an extension .pbix files.
Select the destination which you want to publish the file to — by default it comes with “My workspace” as your own workspace on Power BI Service.
When the upload is in process, you get a dialog box that Publishing is in process.
Once the upload is complete, you will get a confirmation message announcing the “Success”. You can also view Quick Insights and open the shared report from the dialog box. Click on the link to go to Power BI Service to view your report online.
On Power BI Service, the look and feel is similar to what you see on Power BI Desktop. You can also edit the report on Power BI Service.
Publish to Web (Public)
With the Power BI Publish to web option, you can easily embed interactive Power BI visualizations online, such as in blog posts, websites, through emails or social media, from any device. You can also easily edit, update, refresh, or unshare your published visuals.
Please take note that when you choose to Publish to web, anyone on the Internet can view your published report or visual. There is no form of authentication required and any sensitive data pertaining to your organization.
Below are the steps to publish your report to web:
- At the top bar, go to the eclipse (“…”) and expand the options. Under Embed, select Publish to web (public).
- Review the dialog content and select Create embed code.
- Review the warning, as shown here, and confirm that the data is okay to embed in a public website. If it is, select Publish.
- A dialog appears with a link. You can send this link in an email, embed it in code such as an iFrame, or paste it directly into a web page or blog.
To refresh data in your Power BI report, a scheduled refresh plan must be created. As mentioned earlier, everything is packaged into the .pbix file when you publish to Power BI Service and it includes the data set as well.
In Power BI Service, locate the data set under Datasets in the left pane of the portal under the workspace which you have published.
Expand Scheduled refresh and click on the toggle to keep your data up to date. You can select the (1) refresh frequency, (2) the time zone for the refresh to take place and (3) add the time which you want it to refresh.
You can also enable email notifications to be sent to the data owner and include others whenever there is a data refresh failure. Click Apply.
For this report, I have set a 3 hour-interval to poll the web endpoint for any updated data set released by JHU CSSE. Please take note that you can configure up to eight daily time slots if your dataset is on shared capacity, or 48 time slots on Power BI Premium.
You can also review all the Refresh History that took place for this data set as well.
On-demand refresh using Power Automate
Besides scheduled refresh, you can also perform on-demand refresh by clicking Refresh on the report.
I would like to show that you can also trigger the on-demand refresh on the fly using Power Automate (formally Microsoft Flow). I will be using the iOS app to create the flow.
Open Power Automate on your mobile device and you will be on the Browse landing page.
Click on Flows at the Toolbar, click on “+” and click Create from blank.
For every flow, it has to start with a trigger. For this flow, we will be using a manual trigger. Find the connector Flow button for mobile and select the trigger. Name your flow and click “+ New step” to add an action.
In the Search, type “Power BI” to search for the Power BI connector. Under Action, select Refresh a dataset action. You can refer to this link for Power BI connector.
The selected action will be added to the flow. In the new action, you need to provide the following parameters — Workspace and Dataset. If this connection was not previously used, you might need to establish the connection to your account before proceeding to the next step. Click Create when all the necessary parameters are identified.
You can locate this newly created Flow Button under Button in the toolbar.
We are able to publish our Power BI file to Power BI Service and publish it to the web to share with users. With scheduled and on-demand data refresh, we can ensure that the report is reflecting the latest set of data. I have also show on how you can create a simple flow using Power Automate on the mobile app.
For the report, most of the visuals are created using the latest data from a single sheet. For the line chart, the data is a consolidated of all the figures from each day.
In my next post, I will address the advanced use of Power Query to create the table to create this visual and sum up the entire exercise.
The opinions and views expressed here are those of my own and do not necessarily state or reflect those of Microsoft Singapore or Microsoft Corporation.