Power BI reveals how Biden managed to win Pennsylvania

Nikolay Vashkevich
Nikolay Vashkevich

Head of Services

March 9, 2021

Power BI reveals how Biden managed to win Pennsylvania

Back in January, I wrote an article on the elections in the US. In this blog post, I analyzed the reasons why ex-president Trump had lost the electoral battle of Pennsylvania (which eventually cost him his presidency). So the question needs to be asked: why did I decide to make such a research in the first place? Well, there were two fundamental reasons behind this decision. 

First, the last year was full of events that had been influencing the mood of American citizens throughout the year. Surely, those events affected their choice in voting too. It was especially interesting to observe the results in the Swing States, where Joe Biden had managed to win. Second, I wanted to find hidden patterns and discover why the eventual outcomes in many states have changed compared to 2016. Are those changes representing a short-term trend? Or are they all related to the massive turmoil in American society?

And finally: why Pennsylvania, though? Well, it’s one of the key states in the USA. In addition, the Secretary of State made publicly available intermediate results and totals, and it turned out that Pennsylvania represents a sort of an “average” state in terms of income and educational level. Therefore, we assumed that the revealed patterns in this state could be applied to the whole country.

The Process

Here’s what I and our Akveo team of analysts did. We analyzed the poll results in Pennsylvania as a whole and each county, respectively. Then we studied the difference from 2016. In our research, we considered the following indicators:


1. The total turnout by the state and for each county (the ratio of voters to the total number of eligible citizens, and the ratio of voters to the number of registered voters).
2. The total number of votes and the percentage of margins for each county's winning candidate compared with 2016.
3. The absolute value of the margin between candidates for each county.

Data Analysis and Power BI reports

Let’s see in detail the data sources that we used and reviewed (only the major of them). Here's Katsiaryna Tamashevich, Business Intelligence Developer at Akveo:

1. projects.fivethirtyeight.com was the primary source of inspiration. The site contains various analyses on different topics. Moreover, it provides source data and recommendations on calculations. We took the rating data from here.

2. data.pa.gov. This governmental site provides various insights on the state of Pennsylvania. We had high expectations of finding something useful here (like demographic and political data) but with little success. 

3. Kaggle is an excellent source of open datasets. The greatest thing about it is that every dataset has a link to the original source, so it's possible to obtain even more data if needed.

4. GitHub is useful for storing code but also data in some cases.

5. Reuters.com. A trust-worthy source of data, this website includes excellent analyses. However, it took a while to extract the raw data.

6. census.gov. Many other sources refer to this website. The problem is that in our region, census.gov is only accessible via a VPN.

With so many data sources at hand, it’s easy to forget your initial goal. We decided to focus on candidate rating data from FiveThirtyEight, demographic data from the census, and Reuters' election results (downloaded from GitHub and Kaggle). Some of the other datasets were outdated, inconsistent, and didn't show highlights and dependencies.

Initially, we downloaded FiveThirtyEight's rating data from the source base. The difficulty was that FiveThirtyEight post-processed it. We tried to follow the described processing steps but got a different result chart. Therefore, we just took the chart coordinates from the web page code and converted them to actual values.

As we had a comparatively small amount of data, we loaded it to Power BI directly without the database's usage. To match the data, some transformations such as normalization of counties names, parties names, calculation of counties size groups, votes deltas, counties ranks based on the number of votes were required.

Pennsylvania has 67 counties. It’s too much for the pie chart categories number. Unfortunately, the Power BI pie chart can't sum up the smallest categories in one group. Using a calculated column helped us resolve such difficulty for the "Share of votes per county" chart. 

We confronted the same challenge in the "Number of votes per party of each county" bar chart. In this case, we just hid the smallest values. But they are still available in the bookmark via the button "Show all".

In candidate ratings, we presented Biden's and Trump's ratings at the national and Pennsylvania levels respectively. To do so, we just separated a column per line. We added "influenced events" as a separate column to respective dates as markers. Up to now, we have found a better solution for such a case – a line and clustered column chart. This chart allows adding events as columns for better visualization of dependencies between events and rating changes.

For "Biden's and Trump's by county chart" we initially used actual values. The result contained a lot of noise, so it wasn't easy to find out trends. We left actual values as markers and added a line based on smoothed values in calculating average on previous, current, and next values.

It was a real challenge to build the map chart so it would fit the desired result. Neither a standard map nor a filled map allowed us to do it. The standard map allows adding markers, however, it’s impossible to color areas. The filled map was closer to the requirements, but it also had several disadvantages.

For instance, roads and rivers, which are not informative for our investigation, can't be hidden. Borders between counties are not notable. The colors for the infographic were too pale to differentiate between close values. We were ready to go into the sea of custom visuals when we found out that Microsoft hid genuine treasure, one more map chart into preview features: a shape map. It was a love first sight. That visual allowed us to reach the required look. Plus, it supports loading custom maps. The map of Pennsylvania can be found on topojson github. The only problem is that the shape map doesn't have a legend. But we have static ranges, so a matrix with conditional formatting based on the generated table served as our legend. 

The final report was published to Power BI services and the web to embed it to the article.

Conclusions

Based on the analyzed data, we concluded that:

1. The number of voters increased by almost 1.1M (7.3%). It turns like in comparison with 2016, in 2020, more people took an interest in politics and decided to vote.

2. Generally, the 16 largest counties in terms of the population determine how much margin the Democratic Party gets. If the Dems' margin in this county is large enough (more than 10% on average), it overlaps the Republican margin in the remaining smaller counties and determines the victory of the Democrats in Pennsylvania. This fact means that, first of all, you need to analyze the trends in these counties.

Next, we analyzed the average income, education, urban population, and ethnic structure in these counties but we couldn’t manage to find a strict pattern. 

However, depending on the population structure, we have found that counties with a large share of the people of color get more Democratic votes (e.g., Delaware, Lehigh, Dauphin, and Monroe). Thus, we assumed that the percentage for Democrats depends on the percentage of non-white people. While testing this hypothesis, we encountered exceptions in counties such as Allegheny, Bucks, and Montgomery. The percentage of Biden's voters in these counties was much higher than the hypothesis of dependence on non-white voters would explain. Besides, those counties are large, and so is the share of the white population. Therefore, it’s fair to conclude that in large counties, the percentage of votes for Biden may be higher in each ethnic group than in medium and small counties.


The graph above shows that some Pennsylvania counties have higher Republican support than expected (Luzerne, Cumberland, Berks, Yorks, and Lancaster). These counties are located in the same region and have approximately the same economic structure. This means that some unidentified local peculiarities determine the outcome in this region. Since the fact that much larger counties level the margin of votes in these counties, we will not go into detail and study additional factors in the region.

As a result, we managed to build a model that explains the voting results in the sixteen largest counties with a difference of up to 10%.

The number of votes for Democrats (Q) can be calculated as the sum of the number of voters products from each ethnic group (white, black, Hispanic, and Asian Americans) in the county (Ni) relative to the constant turnout values ​​in this group Ti and the percentage of supporting Democrats in this group Di. Here’s the formula: 

Q= Σ ni(TiDiNi)

In addition, there’s a dependency in values Ti and Di depending on a county’s size:

For counties under 400.000 in population:

1. Tw range from 57%-60%, Dw -  40-44%

2. Tb range from 72-76%, Db - 81-84%

3. Th range from 75-80%, Dh - 52-57%

4. Ta range from 68% - 72%, Da - 57-62%

For counties under 600.000 in population:

1. Tw range from 53%-56%, Dw -  70-73%

2. Tb range from 64-68%, Db - 85-88%

3. Th range from 68-72%, Dh - 5-57%

4. Ta range from 60-63%, Da - 59-64%

These data correlate with the fact that depending on the states and ethnic groups, each party's percentage of support slightly changes over several electoral cycles (here's the link to the research).

As we noted earlier, we cannot confidently establish these parameters' probable values ​​for counties within the 400-600k range since these counties are located in the same region, and there is a significant influence of unique local factors. Additionally, we noted that Lackawanna county has an abnormal percentage of Biden votes among other counties. We see the rationale behind the fact that Lackawanna is the home county for Joe Biden as he was born and raised in Scranton.

According to the Census Bureau, the share of people of color in Pennsylvania has increased by 2.6% since 2013. Plus, the share of the population in the 16 largest counties has grown by 0.5% between 2016 and 2020.Thus, we may conclude that the current demographic changes in Pennsylvania are leading to the fact that in the coming years, Democrats will have an electoral advantage due to the growing proportion of citizens who traditionally vote for them.

To Sum Up 

So what is the eventual outcome? Let's conclude. The current demographic trends make the number of Democrats voters grow each year. Otherwise, Republicans have the opportunity to win in Pennsylvania if they can present a strong candidate who will unite several electoral groups and mobilize more people to participate in the election. Also, Republicans have another way to win: in case the Democratic Party cannot attract a significant part of its voters to the polls.


Contact us
Akveo's case

Retool Dashboards with HubSpot Integration

Our client needed a centralized tool to aggregate account and contact activity, improving visibility and decision-making for the sales team.

The solution
We built a Retool application integrated with HubSpot, QuickMail, and Clay.com. The app features dashboards for sorting, filtering, and detailed views of companies, contacts, and deals, along with real-time notifications and bidirectional data syncing.

The result

  • MVP in 50 hours: Delivered a functional application in just 50 hours.
  • Smarter decisions: Enabled data-driven insights for strategic planning.
  • Streamlined operations: Reduced manual tasks with automation and real-time updates.

Learn more about the case

See More
See Less
Akveo's case

Lead Generation Tool to Reduce Manual Work

Our client, Afore Capital, a venture capital firm focused on pre-seed investments, aimed to automate their lead generation processes but struggled with existing out-of-the-box solutions. To tackle this challenge, they sought assistance from our team of Akveo Retool experts.‍

The scope of work
The client needed a tailored solution to log and track inbound deals effectively. They required an application that could facilitate the addition, viewing, and editing of company and founder information, ensuring data integrity and preventing duplicates. Additionally, Afore Capital aimed to integrate external tools like PhantomBuster and LinkedIn to streamline data collection.

The result
By developing a custom Retool application, we streamlined the lead generation process, significantly reducing manual data entry. The application enabled employees to manage inbound deals efficiently while automated workflows for email parsing, notifications, and dynamic reporting enhanced operational efficiency. This allowed Afore Capital's team to focus more on building relationships with potential founders rather than on administrative tasks.

Learn more about the case

See More
See Less
Akveo's case

Retool CMS Application for EdTech Startup

Our client, CutTime, a leading fine arts education management platform, needed a scalable CMS application to improve vendor product management and user experience.

The scope of work
We developed a Retool application that allows vendors to easily upload and manage product listings, handle inventory, and set shipping options. The challenge was to integrate the app with the client’s system, enabling smooth authentication and product management for program directors.

The result
Our solution streamlined product management, reducing manual work for vendors, and significantly improving operational efficiency.

Learn more about the case

See More
See Less
Akveo's case

Building Reconciliation Tool for e-commerce company

Our client was in need of streamlining and simplifying its monthly accounting reconciliation process – preferably automatically. But with a lack of time and low budget for a custom build, development of a comprehensive software wasn’t in the picture. After going through the case and customer’s needs, we decided to implement Retool. And that was the right choice.

The scope of work

Our team developed a custom reconciliation tool designed specifically for the needs of high-volume transaction environments. It automated the processes and provided a comprehensive dashboard for monitoring discrepancies and anomalies in real-time.

The implementation of Retool significantly reduced manual effort, as well as fostered a more efficient and time-saving reconciliation process.

→ Learn more about the case

See More
See Less
Akveo's case

Creating Retool Mobile App for a Wine Seller

A leading spirits and wine seller in Europe required the development of an internal mobile app for private client managers and administrators. The project was supposed to be done in 1,5 months. Considering urgency and the scope of work, our developers decided to use Retool for swift and effective development.

The scope of work

Our developers built a mobile application tailored to the needs of the company's sales force: with a comprehensive overview of client interactions, facilitated order processing, and enabled access to sales history and performance metrics. It was user-friendly, with real-time updates, seamlessly integrated with existing customer databases. 

The result? Increase in productivity of the sales team and improved decision-making process. But most importantly, positive feedback from the customers themselves.

→ Learn more about the case

See More
See Less
Akveo's case

Developing PoC with Low Code for a Tour Operator

To efficiently gather, centralize, and manage data is a challenge for any tour operator. Our client was not an exception. The company was seeking to get an internal software that will source information from third-party APIs and automate the travel itinerary creation process. Preferably, cost- and user-friendly tool.

The scope of work

Our experts ensured the client that all the requirements could be covered by Retool. And just in 40 hours a new software was launched. The tool had a flexible and easy-to-use interface with user authentication and an access management system panel – all the company needed. At the end, Retool was considered the main tool to replace the existing system.

→ Learn more about the case

See More
See Less
Akveo's case

Testing New Generation of Lead Management Tool with Retool

Our client, a venture fund, had challenges with managing lead generation and client acquisition. As the company grew, it aimed to attract more clients and scale faster, as well as automate the processes to save time, improve efficiency and minimize human error. The idea was to craft an internal lead generation tool that will cover all the needs. We’ve agreed that Retool will be a perfect tool for this.

The scope of work

The project initially began as a proof of concept, but soon enough, with each new feature delivered, the company experienced increased engagement and value. 

We developed a web tool that integrates seamlessly with Phantombuster for data extraction and LinkedIn for social outreach. Now, the company has a platform that elevates the efficiency of their lead generation activities and provides deep insights into potential client bases.

→ Learn more about the case

See More
See Less
Akveo's case

Building an Advanced Admin Portal for Streamlined Operations

Confronted with the need for more sophisticated internal tools, an owner of IP Licensing marketplace turned to Retool to utilize its administrative functions. The primary goal was to construct an advanced admin portal that could support complex, multi-layered processes efficiently.

The scope of work

Our client needed help with updating filters and tables for its internal platform. In just 30 hours we've been able to update and create about 6 pages. Following features were introduced: add complex filtering and search, delete records, styling application with custom CSS. 

Together, we have increased performance on most heavy pages and fixed circular dependency issues.

→ Learn more about the case

See More
See Less
Akveo's case

Creating MVP Dashboard for Google Cloud Users

Facing the challenge of unoptimized cloud resource management, a technology firm working with Google Cloud users was looking for a solution to make its operations more efficient. The main idea of the project was to create an MVP for e-commerce shops to test some client hypotheses. Traditional cloud management tools fell short.

The scope of work

Determined to break through limitations, our team of developers turned Retool. We decided to craft an MVP Dashboard specifically for Google Cloud users. This wasn't just about bringing data into view; but about reshaping how teams interact with their cloud environment.

We designed a dashboard that turned complex cloud data into a clear, strategic asset  thanks to comprehensive analytics, tailored metrics, and an intuitive interface, that Retool provides. As the results, an increase in operational efficiency, significant improvement in cost management and resource optimization.

→ Learn more about the case

See More
See Less
Akveo's case

Elevating CRM with Custom HubSpot Sales Dashboard

Our other client, a SaaS startup, that offers collaborative tools for design and engineering teams, was on a quest to supercharge their sales efforts. Traditional CRM systems were limited and not customizable enough. The company sought a solution that could tailor HubSpot to their workflow and analytics needs.

The scope of work

Charged with the task of going beyond standard CRM functions, our team turned to Retool. We wanted to redefine how sales teams interact with their CRM. 

By integrating advanced analytics, custom metrics, and a user-friendly interface, our developers provided a solution that transformed data into a strategic asset.

In 40 hours, three informative dashboards were developed, containing the most sensitive data related to sales activities. These dashboards enable our customer to analyze sales and lead generation performance from a different perspective and establish the appropriate KPIs.

→ Learn more about the case

See More
See Less
Akveo's case

Retool for Sales and CRM Integration

See More
See Less
Akveo's case

Building a PDF Editor with Low-Code

Our client, a leading digital credential IT startup, needed a lot of internal processes to be optimized. But the experience with low-code tools wasn’t sufficient. That’s why the company decided to hire professionals. And our team of developers joined the project.

The scope of work

The client has a program that designs and prints custom badges for customers. The badges need to be “mail-merged” with a person’s info and turned into a PDF to print. But what is the best way to do it?

Our developers decided to use Retool as a core tool. Using custom components and JavaScript, we developed a program that reduced employees' time for designing, putting the data, verifying, and printing PDF badges in one application.

As a result, the new approach significantly reduces the time required by the internal team to organize all the necessary staff for the conference, including badge creation.

→ Learn more about the case

See More
See Less
Subscription
Subscribe via Email

Want to know which websites saw the most traffic growth in your industry? Not sure why your SEO strategy doesn’t work?

Thank you! Your submission has been received!
Oops! Something went wrong while submitting the form.

By clicking “Subscribe” you agree to Akveo Privacy Policy and consent to Akveo using your contact data for newsletter purposes

More articles by themes

Cross
Contact us
AnnaRodionEvgenyExpertExpertExpert
Cross
Got any questions?
Our domain expert is here to answer
If you have any questions, feel free to leave me a personal message on LinkedIn. We are here to help.
Thanks for your question
We will contact you soon
We have a problem
Please, check the entered data
Got any questions?