Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

lc_finance

Make your own News Dashboard in Power BI

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’.

 

Power BI News Dashboard

 

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.

 

Register for an API key to retrieve the news articles

 

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. 

 

News API Pricing for the Power BI News Dashboard

 

After registering, you will receive an email with your API key.

 

News API registration complete

 

With the API key, we are ready to start creating our News Dashboard!

 

Load the data for the Power BI News Dashboard

 

In Power BI, click on Get Data and choose Web.

 

Get data from Web in Power BI

 

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.

 

Get Data from Web prompt

 

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.

 

Prepare the data for the Power BI News dashboard

 

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.

 

Articles search result for the Power BI News Dashboard

 

To open the articles, click on List.

 

Articles search result expanded

 

Afterward, click on Convert to table.

 

Convert to table in Power BI

 

When the prompt appears, choose Ok.

 

Convert to table prompt

 

Now choose the Expand button at the top right of Column 1, unselect ‘Use original column name as prefix’ and click OK.

 

Expand the articles' columns

 

And we finally see all of our articles!

 

List of articles for the Power BI News Dashboard

 

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.

 

Expand the source column to see the articles' source

 

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.

 

Change the type of published date to 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.

 

New calculated column in Power BI

 

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.

 

Sort the published date

 

We are now all ready to create the visualizations!

 

Create the visualizations for the Power BI News Dashboard

 

First visualization: timeframe slicer

 

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.

 

First visualization for Power BI News Dashboard: choose the timeframe

 

Second element: number of articles by date

 

The second element is a Power BI line chart, with publishedDate in Axis and count of title in Values.

 

Second element for Power BI News Dashboard: number of articles by date

 

Third visualization: Word Cloud

 

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.

 

Third visualization for Power BI News Dashboard: a Word Cloud

 

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’.

 

Import a visualization from the marketplace in Power BI

 

You find it by searching for Word Cloud, and you add with the button next to it.

 

Add the Word Cloud visualization

 

Configure it by entering 'description' for Category and 'name' for Excludes. 

 

Configure the Word Cloud

 

At the same time, ensure that Stop Words is On. This removes all articles such as ‘The’, ‘A’ from the word cloud.

 

Remove Stop Words from the Word Cloud

 

Final element: list of articles

 

Now we add the last visualization: the list of articles.

 

Last visualization: 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.

 

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

Comments

This was helpful and very easy to replicate. Great work!

thank you @jberman for the nice comment! I am happy you enjoyed it

Hello,

 

It doesn't seem to work anymore. I can't find X-Api-key from the header dropdown

Hi @danextian ,

 

you can fill in 'X-Api-key' in 'HTTP Request Headers Parameters (optional)' field at the bottom.

It is not a drop-down so you would need to actually fill it in.

 

Does this help you?

 

Let me know

This was fun! Thanks! 

Anonymous

Thanks!

quick query - how will this dashbaord refresh itself ??

@lc_finance 

That's a very interesting atricle on how to use newsapi.

 

I followed your steps and everthing works as expected.

But i cant register this web URL to the PowerBI gateway so as to schedule it to run on a daily basis.. 

 

Could you please provide us we some help on how to achieve that?

I am able to link and get only 100 number of records. is there anyway to get all the records.