#Flow – Email Sentiment Analysis on a #PowerBI dashboard, and Flow

Hello!

A few minutes ago, Gisela wrote a post where she shared how to create a Streaming Dataset in Power BI (link). This feature opens up a new way of using Power BI, and I thought that a good way is to integrate it with the Microsoft Flow.

So I created a Flow with the next steps

  1. The flow will start everytime when you receive a new email
  2. Using Cognitive Services Text Analytics API we will analyze the sentiment of the email subject
  3. The result of the analysis will be sent to a Power BI streaming dataset

Power BI

The first thing to do is create the Streaming Dataset definition in PowerBI. Let’s access the Streaming Analytics collection and add a new streaming dataset.

clipboard04

The type of the dataset will be API

Clipboard07.jpg

And we define the dataset fields. For this example we will use

  • time, DateTime
  • sentiment, Number
  • subject, String (optional)

clipboard02

This is a good time to copy in a notepad the dataset Schema, we will use it later in our Flow. Once created the streaming dataset, we can now create a dashboard view.

  • Create a new dashboard or select an existing one and select the option Add Title of RealTime Data type.
  • Select the streaming dataset that we created in the step above.
  • We define the values to be displayed in a line chart, for example:

clipboard05

And ready, we have created the visualization dashboard in Power BI. It is time to create our Flow.

Microsoft Flow

In Flow we will create a new flow from a blank template. The trigger that we will use for this flow will be the arrival of a new email. Select the option “Office 365 Outlook / / when a new email arrives”

clipboard07

We will see that we have the trigger already configured, verifying new emails received in the Inbox.

clipboard10

The next thing we will do is create a new action to analyze the feelings of the subject of the received email. Add a new action and search for “text analytics” until you find the action “Text Analytics / / Detect sentiment”.

clipboard12

In the configuration of this action, select the Subject of the email as the text to be analyzed.

clipboard15

The final step is to send the information to the Streaming dataset that we created in the previous section. To do this, we add a new action of the type “Power BI / / Add rows to the dataset to”clipboard17

In the action configuration, select the Workspace, the dataset that we have created and “RealTimeData” table. RealTimeData is a fake data table used to display the data in real time.

Also in this step, we configure the message to send with the Schema of the DataSet, replacing the values in the Schema that we have processed in the Flow.clipboard19

That’s it! We already have a running flow which analyses the “subject sentiment” on each received emails and it send this information to a dataset in Power BI.

clipboard21

Power BI Dashboard

In a future post, I’ll show you as is the dashboard in operation. After a couple of “heavy tests” I just realize that I have consumed all my free calls in the Cognitive Services Text Analytics.

I found this response in the execution of the Flow

Body

{ “statusCode”: 401, “message”: “Access denied due to invalid subscription key. Make sure to provide a valid key for an active subscription.” }

And apparently, another test quickly consumed my 5000 free calls to make per month … 😀

clipboard02

 

Greetings @ Toronto

El Bruno

References

42 comments

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.