<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:atom="https://www.w3.org/2005/Atom" xmlns:sy="https://purl.org/rss/1.0/modules/syndication/" xmlns:dc="https://purl.org/dc/elements/1.1/" xmlns:content="https://purl.org/rss/1.0/modules/content/" xmlns:wfw="https://wellformedweb.org/CommentAPI/" xmlns:slash="https://purl.org/rss/1.0/modules/slash/"
  version="2.0">
  <channel>
    <title>Deeper Insights</title>
    <atom:link
      href="https://docs.microsoft.com/archive/blogs/deeperinsights/feed.xml"
      rel="self"
      type="application/rss+xml" />
    <link>https://docs.microsoft.com/archive/blogs/deeperinsights/feed.xml</link>
    <description>Deep Insights across Microsoft Platforms</description>
    <lastBuildDate>Tue, 16 Apr 2019 05:01:30 GMT</lastBuildDate>
    <language>en-US</language>
    <sy:updatePeriod>hourly</sy:updatePeriod>
    <sy:updateFrequency>1</sy:updateFrequency>
    <item>
      <title>New Day. New Role. New Possibilities</title>
      <link>https://docs.microsoft.com/archive/blogs/deeperinsights/new-day-new-role-new-possibilities</link>
      <pubDate>Mon, 11 Jun 2018 16:47:06 GMT</pubDate>
      <dc:creator><![CDATA[JoshLuedeman]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/deeperinsights/?p=495</guid>
      <description><![CDATA[New Day
Things change. That is a constant in life. Sometimes they change for the better, other...]]></description>
      <content:encoded><![CDATA[<h1>New Day</h1>
<img src="https://msdnshared.blob.core.windows.net/media/2018/06/beach_sun-300x200.png" alt="" width="300" height="200" class="size-medium wp-image-515 alignleft" />Things change. That is a constant in life. Sometimes they change for the better, other times we are not so lucky. The best representation of this change in nature, in my opinion, is the path of the sun on a daily basis. It rises and it falls. In between, it is in a state of constant movement through the sky. That comparison is one of the reasons I love Florida. You can watch the sunrise at a Gulf Coast beach, and watch it set at an Atlantic Coast beach, live, and in the same day.

&nbsp;

&nbsp;

Some days are better than others. While some start well, they might not end as nicely, and vice versa. Our careers can be the same way. While I've lived through my share of stormy days, for the most part, I've enjoyed a very "comfortable climate" in my career. As much as we may enjoy a certain day, the only constant in life is that things will change, constantly, like the sun through the sky. Recently, I've experienced a new sunrise in my career.
<h1>Old Role</h1>
I've been at Microsoft since October 2016. I had the amazing opportunity to join the the <a href="https://blogs.msdn.microsoft.com/premier_developer">Premier Support for Developers</a>(PremDev) consulting team. If you're not familiar, the PremDev team is the team that Bradley Ball works on as well. It's a great team of some of the most knowledgeable professionals in the Cloud, Development, and Data spaces. They work with customers to help with proactive projects and advisement on using new and emerging technologies. The last almost two years has been a great learning experience for me. Being a part of the team helped to open my eyes to the "development" side of our world. I've had the opportunity to work with some of our most interesting customers and help them take on their most interesting and perplexing work loads. But just as my analogy shows, the sun must set on every day, and each opportunity.
<h1>New Role</h1>
<img src="https://msdnshared.blob.core.windows.net/media/2018/06/AzureLogo-300x158.png" alt="" width="300" height="158" class="size-medium wp-image-525 alignright" />As the sun rises, I am now a member of the FastTrack for Azure team at Microsoft as a Senior FastTrack Engineer. We are a part of the Customer Experience team under the Azure Engineering group. We help customers move their workloads to Azure, by offering customers education and advisement. For me, it has always been a dream to work with the engineering teams (aka the Product Group) to help make our products better. Now I have that opportunity.

&nbsp;
<h1>New Possibilities</h1>
With a new sunrise, comes a wealth of new possibilities for the new day. In my new role, I get the opportunity to help bring customers in to the cloud, while taking the feedback from our customers and passing it back to the engineering team. Also, this role gives me the opportunity to get better at not being the "give me the keyboard" guy. We want to teach our customers "how to fish" when it comes to deploying in Azure, not "bring them the fish". Our goal is to help customers become self sustaining with Azure. My hope is that with this position I can get back on the conference trail and get back to speaking at conferences. As far as "sunrises" go, this is one of the more bright and enjoyable sunrises of my career, and I'm excited for the opportunities that the new day brings.

&nbsp;]]></content:encoded>
    </item>
    <item>
      <title>Twitter Sentiment Analysis Part III: What We Learned From Justice League &amp; Star Wars</title>
      <link>https://docs.microsoft.com/archive/blogs/deeperinsights/twitter-sentiment-analysis-part-iii-what-we-learned-from-justice-league-star-wars</link>
      <pubDate>Wed, 10 Jan 2018 23:12:32 GMT</pubDate>
      <dc:creator><![CDATA[Bradley Ball]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/deeperinsights/?p=475</guid>
      <description><![CDATA[Hello Dear Reader,

Back in November we revisited out series on Twitter Sentiment Analysis with a...]]></description>
      <content:encoded><![CDATA[Hello Dear Reader,

Back in November we revisited out series on Twitter Sentiment Analysis with a review of the Thor: Ragnarok sentiment and a prediction for the Justice League movie.  The prediction for the Justice League movie was off.  We were not alone.  The film missed even modest industry estimates and under performed.  When we made our initial estimate of $118.5 million we were only $500,000 off the estimate of Box Office Mojo's $118 million.  Instead of confirmation we had to rethink our assumptions.  As with anything in the data science process if you get unexpected results, it raises new questions.

The movies we'd captured thus far had all had positive sentiment.  These where negative.  What did that mean and how would it affect the box office?  We had never collected sentiment before a movie came out.  What is the normal sentiment pattern and could that have indicated box office performance?

&nbsp;

<span style="text-decoration: underline"><strong>JUSTICE LEAGUE</strong></span>

<iframe width="800" height="600" src="https://msit.powerbi.com/view?r=eyJrIjoiZDIyN2IxNWItMzVjMS00ODQ5LWFmMTItYzMzMjE3OGUyNDM4IiwidCI6IjcyZjk4OGJmLTg2ZjEtNDFhZi05MWFiLTJkN2NkMDExZGI0NyIsImMiOjV9" frameborder="0" allowfullscreen="allowfullscreen"></iframe>

&nbsp;

In the cases we have examined thus far, we noticed that sentiment taken before a movie premiers is higher than that of when it premiers.  The sentiment before the premier was 57%.  Where we went wrong was assuming this correlated with what we should expect opening weekend.  Once the movie opened it continued to drop.

Thursday's positive sentiment was only 47%.

Friday was 45%.

Saturday was 44%.

Sunday we stopped the collection half way through the day and it was at 51%.

The high for the entire weekend was 51%, this was 6 points off the sentiment taken on Monday and for the weekend was only at 46%.  This was 11 percentage points off the high sentiment.  In the case of Justice League this showed in a lower box office.  Justice League was the first movie this year we tracked that did not make back its budget in Domestic Box Office gross.

&nbsp;

<span style="text-decoration: underline"><strong>STAR WARS: THE WORST SENTIMENT </strong></span>

Then came Star Wars.  Star Wars has made back it's budget.  The real story here is how far off the previous Star Wars movie in the same trilogy it has fallen.  The box office is not yet closed, but as a year over year average Star Wars: The Last Jedi is behind Star Wars: The Force Awakens by a staggering $242.8 million in Domestic Box Office gross.  Star Wars: The Last Jedi has the lowest positive sentiment of any movie tracked so far.

&nbsp;

&nbsp;

<iframe width="800" height="600" src="https://msit.powerbi.com/view?r=eyJrIjoiNmIyZDNlYTMtYTM3Yy00ZjAwLTgyZDAtMjRmMjQyYTNlZTk2IiwidCI6IjcyZjk4OGJmLTg2ZjEtNDFhZi05MWFiLTJkN2NkMDExZGI0NyIsImMiOjV9" frameborder="0" allowfullscreen="allowfullscreen"></iframe>

As you can see from the visual even though Star Wars has made it's money back by over $300 million, its positive sentiment was 33%.  That is staggering.

&nbsp;

This has lead us to look at additional sources.  You'll notice the IMDB and Metascore ratings are on each report.

&nbsp;

<span style="text-decoration: underline"><strong>SO WHAT NOW</strong></span>

New questions are awesome.  What we've decided is we need more data, we need to branch out to different movie genres and see if patterns hold up.  To do this we need to be able to collect data from Twitter historically, we wanted to add additional scores like IMDB and Metascore.  We want to see what patterns emerged.

Is sentiment always lower after a movie premiers vs. the sentiment before?  What does that drop mean?  If you have a strong brand, like Star Wars, with low sentiment can you still be profitable at the box office?  If you have low sentiment, an established brand, and the movie is not profitable is that indicated in social media sentiment?

&nbsp;

To answer these questions we will use python to scrape and collect data.  Then we will review those patterns and see what we can find.  In our next blogs we will review how we scraped the data, ingested it to SQL DB, and used Azure ML for semantic scoring.

As always Thank you for stopping by.

&nbsp;

Brad]]></content:encoded>
    </item>
    <item>
      <title>Twitter Sentiment Analysis Part II: Thor Ragnarok and Justice League</title>
      <link>https://docs.microsoft.com/archive/blogs/deeperinsights/twitter-sentiment-analysis-part-ii-thor-ragnarok-and-justice-league</link>
      <pubDate>Thu, 16 Nov 2017 12:59:58 GMT</pubDate>
      <dc:creator><![CDATA[Bradley Ball]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/deeperinsights/?p=446</guid>
      <description><![CDATA[Hello Dear Reader!  It's been a few months since last we updated the blog.  This week Josh and I are...]]></description>
      <content:encoded><![CDATA[Hello Dear Reader!  It's been a few months since last we updated the blog.  This week Josh and I are presenting at Visual Studio Live 360 in Orlando.  This week we presented sessions on Polybase, Logic Apps, Power BI, Azure SQL DW, and R.  This was a lot of fun and we prepared some content that we wanted to share with you.

&nbsp;

Previously we discussed the fun I had capturing Twitter sentiment for <a href="https://blogs.msdn.microsoft.com/deeperinsights/2017/07/10/spider-man-homecoming-twitter-sentiment/">Spider-man: Homecoming</a>.  We even blogged a step by step process for how to re-create this experiment, see <a href="https://blogs.msdn.microsoft.com/deeperinsights/2017/07/12/how-to-measure-twitter-sentiment-with-azure-logic-apps-sql-database-and-power-bi/">How to Measure Twitter Sentiment with Azure Logic Apps, SQL Database, and Power BI</a>.  The movie has progressed and the next movie in the Marvel line has arrived, Thor: Ragnarok.  We saw the movie opening night and before we went we asked ourselves a question.  What would the social media sentiment be for Thor and how would it compare to Spider-man?  Would sentiment indicate a trend for opening weekend gross, the amount of money the movie made on it's opening weekend?

So we re-created our experiment.  Let's look at the results below:

&nbsp;

<iframe width="800" height="600" allowfullscreen="allowfullscreen" frameborder="0" src="https://msit.powerbi.com/view?r=eyJrIjoiZjI4NjYzMWQtNjFiZC00NjM4LWFiZTgtNzZhYWRhMmVkNTU5IiwidCI6IjcyZjk4OGJmLTg2ZjEtNDFhZi05MWFiLTJkN2NkMDExZGI0NyIsImMiOjV9"></iframe>

Thor had a very successful opening weekend.  Looking at the matchup between the two movies reveals an interesting trend.

<iframe width="800" height="600" allowfullscreen="allowfullscreen" frameborder="0" src="https://msit.powerbi.com/view?r=eyJrIjoiN2ZiZWU0YmYtMzVjNy00MmFlLTk0Y2EtMmE4NjVlOGY1OTNlIiwidCI6IjcyZjk4OGJmLTg2ZjEtNDFhZi05MWFiLTJkN2NkMDExZGI0NyIsImMiOjV9"></iframe>
<div>Thor beat Spider-man in sentiment analysis by 7.61%.  Thor also beat Spider-man in opening with an opening day Domestic gross of $122.74 million, winning by $5.17 million.  If we measure this by sentiment that would mean that for every extra point of positive sentiment Thor gained an additional $750,000.</div>&nbsp;
<div></div>
<div></div>
<div>In the session we reviewed how we stored, and scored the data.  As an experiment with the class we then sought to develop a hypothesis: Could we measure the Twitter sentiment of a movie before it opens that is in the same type of demographic/genera and use that to estimate the Domestic gross for the box office?</div> &nbsp;
<div></div>
<div></div>
<div>Well the long awaited Justice League movie comes out today, and we took this opportunity to use Logic Apps to stream data into our database.  We did this for the duration of Monday.  The Justice League sentiment, for that specific window, was 56.9% positive.  Not as much as Thor.  If we use Spider-man as a baseline and estimate $750,000 * 2(the percentage difference) then that means Justice League would have an opening weekend of $118.5 million dollars.</div>
&nbsp;
<div></div>
<div></div>
<div>This also raises the question, is the sentiment before a movie equal to the sentiment of the opening weekend?  We didn't track that with Thor or Spider-man.</div>
&nbsp;
<div></div>
<div></div>
<div>This was some of the fun that we had in our pre-con to show how you can utilize modern data sources like social media data to try to spot and anticipate trends.  Alright Dear Reader, now go see the movie and we'll find out how close we are!  As always Thank you for reading!</div>
&nbsp;
<div></div>
<div></div>
<div>Thanks,</div>
<div></div>
&nbsp;
<div>Brad</div>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>]]></content:encoded>
    </item>
    <item>
      <title>When is the Best Day to See Your Favorite Baseball Team?</title>
      <link>https://docs.microsoft.com/archive/blogs/deeperinsights/when-is-the-best-day-to-see-your-favorite-baseball-team</link>
      <pubDate>Thu, 13 Jul 2017 13:46:07 GMT</pubDate>
      <dc:creator><![CDATA[Bradley Ball]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/deeperinsights/?p=25</guid>
      <description><![CDATA[Hello Dear Reader!  Continuing on our focus of real data, last year Josh Luedeman (@JoshLuedeman)...]]></description>
      <content:encoded><![CDATA[<img src="https://msdnshared.blob.core.windows.net/media/2017/07/cubs-225x300.jpg" alt="" width="225" height="300" class="wp-image-435 alignleft" />Hello Dear Reader!  Continuing on our focus of real data, last year Josh Luedeman (<a href="https://twitter.com/joshluedeman">@JoshLuedeman</a>) were trying to figure out this exact problem.  How could we find real, free, and very cool data?  Enter <a href="https://www.retrosheet.org">RetroSheet.org</a>.

RetroSheet is a team of volunteers that have managed to salvage the play by play data for every game of baseball from 1922 - 2016*.  Josh and I looked at this data set as a great way to use some new tools and learn more about the teams and game we love.  We then used our data skills to ETL out all of the box scores, cleanse the data, and review the data for accuracy.  Then we decided to review a subset of data based on the modern era of baseball.  For this we selected all games played between 1990 and 2016.

Now we had the data, what we needed was a question.  Eventually we settled on what was the best day of the week to see your team play.  My favorite team is the Chicago Cubs, has been my whole life.  Last year was a good year to be a Cubs fan, they broke a 108 year drought and won the World Series.  This picture is from my trip up to Wrigley Field to see Game 5 of the World Series last year.

&nbsp;

Enough exposition let's look at the data!  This is an<a href="https://powerbi.microsoft.com/en-us/documentation/powerbi-developer-embedding/"> interactive embedded Power BI report</a>, please pick your favorite team and look at the results!  I'll keep typing below.

<iframe width="800" height="600" src="https://msit.powerbi.com/view?r=eyJrIjoiNGFhODBhNTktMWYzNi00ZDRmLWJhNzUtYzlhNmQ0MWNjYTRmIiwidCI6IjcyZjk4OGJmLTg2ZjEtNDFhZi05MWFiLTJkN2NkMDExZGI0NyIsImMiOjV9" frameborder="0" allowfullscreen="allowfullscreen"></iframe>

My predicament is that I have a family of 5 that I would want to take to a game.  Attending an in person baseball game can get expensive.  Winning and losing in sports can have a lot of different criteria.  I wanted to keep this simple.  Could I find the best day of the week to see my team play?

Historic Data Analysis based on:
<ul>
 	<li>Day of the week a game is played on</li>
 	<li>If it is a home or away game</li>
 	<li>Does my team have a winning or losing record</li>
 	<li>What opponent are they facing</li>
</ul>
I felt this would give me a good basis to determine if it was worth it to make an expensive trip to take the family to a game.  I started out my experiment in R.  I found very quickly that a trend emerged when I looked at only the days of the week and wins and losses.  This is a plot I created in R studio.

<img src="https://msdnshared.blob.core.windows.net/media/2017/07/best-day-of-the-week-to-see-the-cubs.png" alt="" width="970" height="468" class="aligncenter wp-image-445 size-full" />

In this we can see that the day of the week the Cubs win the most on is within a grouping of Saturday, Friday, and Sunday.  Monday looks low on the list.  When  I look at the day they lose the least, that happens to be Monday.
<table width="291" style="border-collapse: collapse;width: 289px"><colgroup> <col width="108" style="width: 81pt" /> <col width="36" style="width: 27pt" /> <col width="45" style="width: 34pt" /> <col width="102" style="width: 77pt" /> </colgroup>
<tbody align="center">
<tr>
<td>Day of the Week</td>
<td>Wins</td>
<td>Losses</td>
<td>TotalGames</td>
</tr>
<tr>
<td>Sunday</td>
<td>329</td>
<td>360</td>
<td>689</td>
</tr>
<tr>
<td>Monday</td>
<td>260</td>
<td>222</td>
<td>482</td>
</tr>
<tr>
<td>Tuesday</td>
<td>302</td>
<td>340</td>
<td>642</td>
</tr>
<tr>
<td>Wednesday</td>
<td>314</td>
<td>343</td>
<td>657</td>
</tr>
<tr>
<td>Thursday</td>
<td>221</td>
<td>238</td>
<td>459</td>
</tr>
<tr>
<td>Friday</td>
<td>336</td>
<td>349</td>
<td>685</td>
</tr>
<tr>
<td>Saturday</td>
<td>338</td>
<td>353</td>
<td>69</td>
</tr>
</tbody>
</table>
After looking at the data it is clear the most likely day for me to go see the Cubs and have them win is on Monday!  At home on Monday when the Cubs have a winning record, I interpreted that to mean a record of .500 or greater, I have a 60% chance of seeing them win.  If I'm going to take the family all the way up to Chicago to see a game, I should do it on a Monday.

&nbsp;

There are a lot of cool things waiting to be discovered in this data.  For instance did you know that if you are a New York Yankees fan and the Yankees have a loosing record, they have a better chance of winning on a Thursday than they do if they had a winning record!  We'll talk about how we built this in a future blog post.  We used Azure Storage, Polybase, SQL Server with advanced analytics, SQL Azure DB, R, R Studio, and Power BI to develop this post.  Thank you for reading!

How about you Dear Reader?  Do you have a favorite team?  Did you notice any interesting trends?  Sound off below!

&nbsp;

Thanks,

&nbsp;

Brad

&nbsp;

<em>*There are some games where data may be missing, and there may be some errors in the data set, for many Retrosheets.org is the go to place for baseball data.  This data and anything we put forward may have a +/- confidence value of 1 standard deviation.  </em><i>This Sample Code is provided for the purpose of illustration only and is not intended to be used in a production environment.</i><i>   Please don't use this information for anything that could cost you money.  This data is for fun, and should not be used to interpret future events or outcomes.</i>]]></content:encoded>
    </item>
    <item>
      <title>How to Measure Twitter Sentiment with Azure Logic Apps, SQL Database, and Power BI</title>
      <link>https://docs.microsoft.com/archive/blogs/deeperinsights/how-to-measure-twitter-sentiment-with-azure-logic-apps-sql-database-and-power-bi</link>
      <pubDate>Wed, 12 Jul 2017 09:58:42 GMT</pubDate>
      <dc:creator><![CDATA[Bradley Ball]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/deeperinsights/?p=195</guid>
      <description><![CDATA[Hello Dear Reader! I've seen plenty of cool demos using made up data. I've worked on POC's with...]]></description>
      <content:encoded><![CDATA[Hello Dear Reader! I've seen plenty of cool demos using made up data. I've worked on POC's with customer data.  Data that I couldn't publish or blog about. I find myself in a dilemma. I want to do cool things and write about it, but I want to do it with REAL data. That being said, last weekend I found the perfect opportunity. I went to see <a target="_blank" href="https://www.spidermanhomecoming.com/" rel="noopener noreferrer">Spider-Man Homecoming</a>, with my son Zachary.  I had been looking at Azure Logic Service and playing around with it.  I watched a great video by Jeff Hollan (<a href="https://twitter.com/jeffhollan">@Twitter</a> | <a href="https://azure.microsoft.com/en-us/services/logic-apps/">Channel 9 Video</a>) PM of Azure Logic Apps on the subject.  I also found a really great post about<a href="https://docs.microsoft.com/en-us/azure/azure-functions/functions-twitter-email"> Creating a function that integrates with Azure Logic Apps</a>.

So I did just that.  I tracked, measured, stored, and visualized <a href="https://blogs.msdn.microsoft.com/deeperinsights/2017/07/10/spider-man-homecoming-twitter-sentiment/">Spider-Man Homecoming's Twitter Sentiment</a>.   I used several services along the way.  Initially I started out tracking everything in Azure Logic Apps, but I shifted a bit from there when I produced my final reports.  This blog will walk you through what I did. First we will create a real time data source for Power BI using Azure Logic Apps and add a parallel task to store Tweet data using in SQL Database.  Finally we will build Power BI reports off of this data.

&nbsp;

<strong> Create a real time data source for Power BI using Azure Logic Apps</strong>

First we create a Cognitive Services API.  You do this in the Azure Portal, and after creation you want to get your API key.

<img src="https://msdnshared.blob.core.windows.net/media/2017/07/screen-1-1-300x226.jpg" alt="" width="300" height="226" class="size-medium wp-image-205 aligncenter" />

<img src="https://msdnshared.blob.core.windows.net/media/2017/07/screen-1-4-300x94.jpg" alt="" width="300" height="94" class="size-medium wp-image-207 aligncenter" />

To do this you can click on the Show Access Key's link after creating the service.

<img src="https://msdnshared.blob.core.windows.net/media/2017/07/screen-1-5.jpg" alt="" width="222" height="254" class="wp-image-215 aligncenter" />

Copy Key 1, you'll need that later.

Here's a quick picture of what we will build.  <u>Don't build this yet</u>!  We will come back to it.  There are a few things we need to build first, but I like to know the big picture first.

<img src="https://msdnshared.blob.core.windows.net/media/2017/07/LogicAppImage-1024x717.jpg" alt="" width="1024" height="717" class="aligncenter wp-image-225 size-large" />

We will stat off with a When a new tweet is posted trigger.  This will require you to have a Twitter account and authenticate with the service.  You will then create a new action.  Select Text Analytics, this will require the key that we created earlier to score the sentiment.   The next two actions we will create require  our additional pre-work.  You will need to create a live data set in Power BI and create a SQL Database and a table that data will be stored in.  So before we put this together let's create the live data set and SQL table.

&nbsp;

If you got excited and started creating a Logic app before creating these two you can save just your tweet and cognitive service API.  MAKE SURE YOU DISABLE THE LOGIC APP BEFORE LEAVING IT.  We are not ready for it to run yet.  Otherwise it will just start recording Tweets and sentiment without anywhere to store it.

<img src="https://msdnshared.blob.core.windows.net/media/2017/07/pause-your-logic-app.jpg" alt="" width="980" height="406" class="aligncenter wp-image-235 size-full" />

In Power BI to create our live data source, log into <a href="https://powerbi.microsoft.com/en-us/">PowerBI.com</a> and enter your workspace.  Here you will see I'm logged into my Power BI account and I'm in my Spider-Man Homecoming workspace.

&nbsp;

<img src="https://msdnshared.blob.core.windows.net/media/2017/07/Streaming-Data-Set1.jpg" alt="" width="982" height="403" class="aligncenter wp-image-266 size-full" />

Select the Streaming dataset option under Create in the upper right hand corner.
<img src="https://msdnshared.blob.core.windows.net/media/2017/07/Streaming-Data-Set-2-300x256.jpg" alt="" width="300" height="256" class="size-medium wp-image-245 aligncenter" />

The default option of API should be selected.  If not click API and click next.

<img src="https://msdnshared.blob.core.windows.net/media/2017/07/Streaming-Data-Set-3-201x300.jpg" alt="" width="201" height="300" class="size-medium wp-image-255 aligncenter" />

Now we need to create the data format that we want to store our data in.  You can select anything you want to consume, for me I just wanted to get the tweet text, location, when the tweet was created, users number of followers, and our sentiment score.  Adding these fields and setting them to the appropriate data type will allow us to create a live streaming visual on a dashboard.  It will also dynamically build the JSON required for this.  Make sure you click Historical data analysis

<img src="https://msdnshared.blob.core.windows.net/media/2017/07/Streaming-Data-Set-4.jpg" alt="" width="363" height="531" class="aligncenter wp-image-305 size-full" />

&nbsp;

Click Done when you are finished.  Now Create your SQL Database and name it, then create a table.  This is the T-SQL Script I used.  If you do not know<a href="https://docs.microsoft.com/en-us/azure/sql-database/sql-database-design-first-database"> how to create a SQL Database click here for a quick tutorial</a>.
<code>
drop table if exists dbo.tweetinfo_scored
go</code>

<code>create table tweetinfo_scored(
<span>        </span>myid int identity(1,1) primary key
<span>        </span>,userName nvarchar(500) null
<span>        </span>,TweetText nvarchar(max) null
<span>        </span>,description nvarchar(500) null
<span>        </span>,location nvarchar(500) null
<span>        </span>,retweetCount int null
<span>        </span>,TweetedBy varchar(500) null
<span>        </span>,SentimentScore nvarchar(20) null
<span>        </span>,followers int null
<span>        </span>,createdAt nvarchar(500) null
)</code>

Now we create our Azure Logic App.

<img src="https://msdnshared.blob.core.windows.net/media/2017/07/screen-1-261x300.jpg" alt="" width="261" height="300" class="size-medium wp-image-216 aligncenter" />

Then we will select a Blank Logic App.

<img src="https://msdnshared.blob.core.windows.net/media/2017/07/screen-3-300x201.jpg" alt="" width="300" height="201" class="size-medium wp-image-217 aligncenter" />

Now we start to build everything.  Remember you will need four things:
<ol>
 	<li>Twitter credentials to authenticate to the service</li>
 	<li>The API key for Sentiment Analysis</li>
 	<li>A Power BI account
<ol>
 	<li><em>*authentication to Power BI works best with the the Chrome browser, I'd recommend using that</em></li>
</ol>
</li>
 	<li>Database level user name and password for your SQL Database instance and make sure you've created your table.</li>
</ol>
First create the Twitter event.  If you want to see the wide selection of different events to collect data feel free to scroll down.   There are quite a few selections e.g.  Dynamics, Facebook, Twitter, Oracle, Salesforce, and more.

<img src="https://msdnshared.blob.core.windows.net/media/2017/07/screen-4-276x300.jpg" alt="" width="276" height="300" class="size-medium wp-image-306 aligncenter" />

We'll select the Twitter event.  Then we will need to authenticate to Twitter.

<img src="https://msdnshared.blob.core.windows.net/media/2017/07/screen-5-300x111.jpg" alt="" width="300" height="111" class="size-medium wp-image-315 aligncenter" />

<img src="https://msdnshared.blob.core.windows.net/media/2017/07/screen-6-300x74.jpg" alt="" width="300" height="74" class="size-medium wp-image-325 aligncenter" />

<img src="https://msdnshared.blob.core.windows.net/media/2017/07/screen-7-300x255.jpg" alt="" width="300" height="255" class="size-medium wp-image-335 aligncenter" /> Now that we are authenticated to Twitter a token has been sent that will allow us to access the Twitter stream from this account.  Initially I set my frequency to 1 minute.  I changed that to 15 seconds later.  All of this depends on how quickly you want to collect data and process it.

&nbsp;

<img src="https://msdnshared.blob.core.windows.net/media/2017/07/Screen-8-300x156.jpg" alt="" width="300" height="156" class="size-medium wp-image-345 aligncenter" />

<img src="https://msdnshared.blob.core.windows.net/media/2017/07/Screen-9-300x160.jpg" alt="" width="300" height="160" class="size-medium wp-image-355 aligncenter" />

Now we can click our next step and add our Detect Sentiment action.  Add the Tweet Text to determine sentiment based on the text and create our connection to the Cognitive API, remember your key from earlier this is where you will need it.

<img src="https://msdnshared.blob.core.windows.net/media/2017/07/cog-api-1-300x108.jpg" alt="" width="300" height="108" class="size-medium wp-image-365 aligncenter" />

Click Next step.  We'll add our Power BI action next.  We'll select the Power BI - Add rows to a dataset action.

<img src="https://msdnshared.blob.core.windows.net/media/2017/07/cog-api-2-300x187.jpg" alt="" width="300" height="187" class="size-medium wp-image-385 aligncenter" />

Once we select that we will need to authenticate to our  Power BI account.  After you authenticate select your workspace, mine is spiderman homecoming.  Select the name of the streaming data set we created, mine is Twit2, and finally the Table name by default this should be RealTimeData.

<img src="https://msdnshared.blob.core.windows.net/media/2017/07/power-bi-action-1-300x135.jpg" alt="" width="300" height="135" class="size-medium wp-image-395 aligncenter" />

Now we will populate the fields we had created earlier.

<img src="https://msdnshared.blob.core.windows.net/media/2017/07/power-bi-action-2-300x255.jpg" alt="" width="300" height="255" class="size-medium wp-image-375 aligncenter" />

From here I could keep all of my actions inline.  However, I would like to add a parallel branch to write to my Azure SQL Database.  On the arrow between Detect Sentiment and Add rows to a dataset click, select Add a parallel branch, select Add an action.

<img src="https://msdnshared.blob.core.windows.net/media/2017/07/parallel-action-300x254.jpg" alt="" width="300" height="254" class="size-medium wp-image-427 aligncenter" />

Choose SQL Server.

<img src="https://msdnshared.blob.core.windows.net/media/2017/07/sql-server-1-300x106.jpg" alt="" width="300" height="106" class="size-medium wp-image-405 aligncenter" />

&nbsp;

Select SQL Server - Insert Row.

<img src="https://msdnshared.blob.core.windows.net/media/2017/07/sql-server-2-143x300.jpg" alt="" width="143" height="300" class="size-medium wp-image-415 aligncenter" />

Dear Reader you may be asking.  "Why SQL Server?"

I could have used Azure Storage, Hadoop, Spark, Azure Data Lake, why SQL Server?  I would have needed to create a CSV file and write the contents to the file and deposit it in the big data source.  Later I'm going to use this data in Power BI, and I have the option of using Direct Query or loading the data using Power Query.  I can also use Azure ML to Import data from my SQL Database.   Granted I could also do this doing each, but I chose SQL Database for simplicity and how it just works with everything else I wanted to do.  Your choice of data source may change based on what you are collecting.  You have options, and that's good.

Now we will need to authenticate to our SQL Server.  Once we do that we can select our table and begin entering our data.  <img src="https://msdnshared.blob.core.windows.net/media/2017/07/sql-server-3-143x300.jpg" alt="" width="143" height="300" class="size-medium wp-image-425 aligncenter" />

At this point our Logic app should look like this.

<img src="https://msdnshared.blob.core.windows.net/media/2017/07/LogicAppImage-1024x717.jpg" alt="" width="1024" height="717" class="aligncenter wp-image-225 size-large" />

&nbsp;

Now save and run your app.  Back in the screen for the Logic App you will see if everything runs successfully.

<img src="https://msdnshared.blob.core.windows.net/media/2017/07/final-runs1-203x300.jpg" alt="" width="203" height="300" class="size-medium wp-image-285 aligncenter" />

&nbsp;

At this point you can go into Power BI and start dragging data onto your dashboard, or go into SMS and do query to validate data is streaming into the database.

<img src="https://msdnshared.blob.core.windows.net/media/2017/07/Data-is-working-1024x540.jpg" alt="" width="1024" height="540" class="aligncenter wp-image-295 size-large" />

&nbsp;

In this case I can see that I'm getting data back in SSMS and when I added a Map visualization and the sentiment score I could see where tweets were coming in, from all over the world.  Pretty cool!  Alright Dear Reader, I'm off for the next cup of coffee.  I hope you enjoyed this and as always, Thank you for stopping by.

&nbsp;

Thanks,

&nbsp;

Brad

&nbsp;]]></content:encoded>
    </item>
    <item>
      <title>Spider-Man Homecoming Twitter Sentiment</title>
      <link>https://docs.microsoft.com/archive/blogs/deeperinsights/spider-man-homecoming-twitter-sentiment</link>
      <pubDate>Mon, 10 Jul 2017 14:47:24 GMT</pubDate>
      <dc:creator><![CDATA[Bradley Ball]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/deeperinsights/?p=96</guid>
      <description><![CDATA[Hello Dear Reader!  This past Thursday night I took my son Zachary to see Spider-Man Homecoming, it...]]></description>
      <content:encoded><![CDATA[Hello Dear Reader!  This past Thursday night I took my son Zachary to see Spider-Man Homecoming, it was an amazing movie with a fantastic cast.  Both of us are BIG comic book guys, and we enjoyed it immensely.  As a matter of fact we both enjoyed it so much that I couldn’t help but wonder how the rest of the world felt!  You’ve probably seen different ways to view Twitter sentiment analysis, but I wanted to do this today using Azure Logic Apps to create a real-time Power BI Dashboard, with a live data source using Azure SQL Database.  Want to see how we <a href="https://blogs.msdn.microsoft.com/deeperinsights/2017/07/12/how-to-measure-twitter-sentiment-with-azure-logic-apps-sql-database-and-power-bi/">built all of this?  Click here to read How to Measure Twitter Sentiment with Azure Logic Apps, SQL Database, and Power BI.</a>

&nbsp;

<iframe width="800" height="600" src="https://msit.powerbi.com/view?r=eyJrIjoiMmFkMjZiNjAtNjBlOC00ZTBiLWJmOGQtYWNhZDQ4MjNmMTVhIiwidCI6IjcyZjk4OGJmLTg2ZjEtNDFhZi05MWFiLTJkN2NkMDExZGI0NyIsImMiOjV9" frameborder="0" allowfullscreen="allowfullscreen"></iframe>

&nbsp;

The majority of the twitter sentiment was positive!  Over 55% of the response based on the Twitter Semantic Model I used in Azure ML.
<table width="181" style="border-collapse: collapse;width: 136pt"><colgroup> <col width="65" style="width: 48pt" /> <col width="43" style="width: 32pt" /> <col width="74" style="width: 55pt" /> </colgroup>
<tbody>
<tr style="height: 15.0pt">
<td width="65" height="20" class="xl149" style="width: 48pt;height: 15.0pt">Response</td>
<td width="43" class="xl149" style="width: 32pt">Count</td>
<td width="74" class="xl149" style="width: 55pt">Percentage</td>
</tr>
<tr style="height: 15.0pt">
<td height="20" class="xl150" style="height: 15.0pt">negative</td>
<td class="xl150" align="right">4777</td>
<td class="xl150" align="right">17%</td>
</tr>
<tr style="height: 15.0pt">
<td height="20" class="xl150" style="height: 15.0pt">neutral</td>
<td class="xl150" align="right">7668</td>
<td class="xl150" align="right">28%</td>
</tr>
<tr style="height: 15.0pt">
<td height="20" class="xl150" style="height: 15.0pt">positive</td>
<td class="xl150" align="right">15150</td>
<td class="xl150" align="right">55%</td>
</tr>
</tbody>
</table>
Reviewing the text of the tweets I felt that was low, but that just means the model has room to be trained.  Looking at our Power BI Report I can see the influential Twitter users, those with the most followers, had the most re-tweets.  This has more than just social relevance, this translates to dollars quite easily.

&nbsp;

<iframe width="800" height="600" src="https://msit.powerbi.com/view?r=eyJrIjoiODY3N2FkYjctZTljZC00NjMxLWE4Y2UtMTAyMzkzYmFlZDI1IiwidCI6IjcyZjk4OGJmLTg2ZjEtNDFhZi05MWFiLTJkN2NkMDExZGI0NyIsImMiOjV9" frameborder="0" allowfullscreen="allowfullscreen"></iframe>

Since the launch of the Marvel Cinematic Universe, MCU, back in 2008 the largest opening weekend for a Marvel character in their origin movie belonged to Iron Man.  This is fitting.  Iron Man and Robert Downey Jr. kick started the MCU.  They started in style with a $99 million dollar opening weekend, going on to gross $318 million dollars domestically and over half a billion world wide.

The next closest movie was the Guardians of the Galaxy.  While it was not a solo-hero movie, it was still the premier for the group.  They garnered $94 million on their opening weekend.  By the end of their run they had netted over $333 million domestically and over $770 million world wide.

Looking at the overall Marvel Cinematic Universe, Spider-Man Homecoming is in the mid-range for openings overall.  Spider-Man Homecoming has already earned the distinction of unseating Iron Man to capture $117 million in it's opening weekend.  If the trend continues, our friendly neighborhood Spider-Man may just end up with over $300 million.

Based on the sentiment and the first weekend, Spider-Man is just getting started.  So is this a big gain on previous Spider-Man movies?  The last two Spider-Man movies averaged $232 million, the latter earning $202 million.  The average MCU movie thus far has averaged $296 million.  Spider-Man is off to a good start, we'll see where it goes from here!

Tune in for later this week when we explore <a href="https://blogs.msdn.microsoft.com/deeperinsights/2017/07/12/how-to-measure-twitter-sentiment-with-azure-logic-apps-sql-database-and-power-bi/">how to collect, store, and create these visuals easily and quickly using the cloud!</a>

Thanks for stopping by.

&nbsp;

Thanks,

Brad]]></content:encoded>
    </item>
  </channel>
</rss>