Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started
In this tutorial, I will walk you through creating your own Power BI News Dashboard, which visualizes news about any topic that might interest you. While most of us use Power BI to analyze our own data, the ‘Get Data from Web’ functionality makes it just as easy to analyze external data.
The possibilities are endless, from following your favorite sports team to following news about a competitor, news on tech topics, local news, etc.
Below is what the News Dashboard looks like for the topic ‘Power BI’.
The source data comes from News API (https://newsapi.org/). News API provides “breaking news headlines and articles from over 30 000 news sources and blogs”.
To have a preview of what we will build, you can download the finished template from here.
The API key is your login for accessing the news articles. News API proposes a plan called Developer which includes a free API key. You can review their website to ensure that this is the correct plan for you.
Head to https://newsapi.org/, then select Pricing at the top. If it’s applicable to you, choose the Developer plan which is the free plan.
After registering, you will receive an email with your API key.
With the API key, we are ready to start creating our News Dashboard!
In Power BI, click on Get Data and choose Web.
In the menu that appears, choose Advanced and fill it in as below.
URL parts:
https://newsapi.org/v2/everything?
q=power%20bi
&pageSize=100
&language=en
HTTP request header parameters:
X-Api-Key enter-here-your-API-key
Once filled, it looks like this.
Here is the explanation of what we filled in.
For the URL parts, the first line is the website address and never changes.
The second line is used for the search query. In the example, I search for Power BI, but you can search for anything you wish (local and global news, other tech topics, sports team, companies, etc.). If your search phrase has more than one word, the words should be separated by ‘%20’.
The third and fourth lines are optional, they set the number of results received and the language of the articles. News API limits the maximum of results received to 100, so if you want to receive more results you need to create more queries.
If you are interested in checking out all available options for the articles search, you can check the page here.
Once you click on ok, you will see the result of the data load.
The result tells us that there are 891 articles for our search, however, only 100 are downloaded as this is the limit set by News API.
To open the articles, click on List.
Afterward, click on Convert to table.
When the prompt appears, choose Ok.
Now choose the Expand button at the top right of Column 1, unselect ‘Use original column name as prefix’ and click OK.
And we finally see all of our articles!
There is one more column to expand for the source of our articles (the news site or blog site where the article is from). For that, repeat the same step as above by clicking at the top right of the source column.
Before leaving Query Editor, we need to change the format of the publishedAt column to Date/Time. This will allow us to use this information in the dashboard.
Right-click on publishedAt and choose Change Type, then Date/Time.
We are almost ready to create the visualizations.
Before that, we need to create two additional columns: one column with the Date only (instead of Date and Time as in the source data) and another column to correctly sort the dates.
Click on Modeling, then New Column.
Here are the two formulas:
publishedDate = FORMAT([publishedAt],"mmm-dd")
publishedDate order = FORMAT([publishedAt],"yyyymmdd")
After the two new columns are created, click on publishedDate and Sort it by publishedDate order.
We are now all ready to create the visualizations!
The first element of the dashboard is a slicer for choosing the timeframe. This is a standard Power BI slicer with the measure publishedAt that we just created.
The second element is a Power BI line chart, with publishedDate in Axis and count of title in Values.
The third visualization is a Word Cloud, showing the most recurring words in the articles. The bigger the word is in the word cloud, the more recurring it is in the articles. The great part of this visualization is that words can be selected, and the news articles are automatically filtered based on these words.
This is not a standard Power BI chart so it should be imported from the marketplace. Click on the three dots at the bottom right of the visualizations, and choose ‘Import from marketplace’.
You find it by searching for Word Cloud, and you add with the button next to it.
Configure it by entering 'description' for Category and 'name' for Excludes.
At the same time, ensure that Stop Words is On. This removes all articles such as ‘The’, ‘A’ from the word cloud.
Now we add the last visualization: the list of articles.
This is a table chart with multiple columns. It has two ‘special’ columns, which are the image column with the article image, and the url column with a link to the article.
To correctly show the image and the link, we need to configure these two columns.
Click on image URL, then go to Modeling and choose Data Category: Image URL.
For URL, do the same but choose Data Category: Web URL.
You are done. Congratulations on creating your own News Dashboard!
I hope you found this useful.
You can download the final template from here.
If you have comments or questions, feel free to write me at lc@finance-bi.com.
LC
Interested in Power BI and DAX templates? Check out my blog at www.finance-bi.com
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.