Questions
ECON3310001.1251 Extra Credit Assignment: Power BI & SQL
Numerical
R & Power BI In this exercise, you will embed R into Power BI to analyze industry employment data. The following steps are the same as the previous exercise. Make sure you load the same data again: Step 1: Use Embedded SQL to Import Data Click Get Data, then choose MySQL. Enter the following connection details: Server: dadata.bensresearch.com Database: industry Click Advanced Options to embed custom SQL queries. Paste and run each of the queries below one at a time: SELECT TSE.DataYear, TSE.StateShort, SUM(HHI.Herf * ISE.Emp / TSE.Emp) AS WHHI FROM (SELECT StateShort, DataYear, SUM(ExpEmpValue) AS Emp FROM StateData WHERE IndustryCodeLength = 6 GROUP BY StateShort, DataYear) AS TSE JOIN (SELECT StateShort, DataYear, IndustryCode, ExpEmpValue AS Emp FROM StateData WHERE IndustryCodeLength = 6) AS ISE ON TSE.StateShort = ISE.StateShort AND TSE.DataYear = ISE.DataYear JOIN HHI ON ISE.DataYear = HHI.DataYear AND ISE.IndustryCode = HHI.IndustryCode GROUP BY TSE.DataYear, TSE.StateShort ORDER BY WHHI SELECT * FROM HHI SELECT * FROM StateData SELECT StateShort, DataYear, SUM(ExpEmpValue) AS Emp FROM StateData WHERE IndustryCodeLength = 6 GROUP BY StateShort, DataYear Rename your resulting tables as follows: WHHI (for the weighted HHI results) HHI StateData StateEmp (total employment by state) Step 2: Import NAICS Labels Click Get Data again. Browse for the file NAICS.csv and load it. Your result should look like this: Step 3: Using R Once you have these results. Select the R visualization. Drag only DataYear, ExpEmpValue and IndustryCodeLength to it. Then write the code below, which transforms and plot the data: library(sqldf) plot <- sqldf("SELECT DataYear, SUM(ExpEmpValue) AS Emp FROM dataset WHERE IndustryCodeLength = 6 GROUP BY DataYear") library(ggplot2) ggplot(plot, aes(x = DataYear, y = Emp)) + geom_line(color = "steelblue", size = 1) + geom_point(color = "steelblue", size = 2) + labs(title = "Employment Over Time", x = "Year", y = "Employment" ) + theme_minimal() Question: Inspect the resulting graph. Which year had the lowest number of manufacturing jobs nationwide? Ignore years not included in our dataset.
View Explanation
Verified Answer
Please login to view
Step-by-Step Analysis
Initial observation: The question asks to inspect the resulting graph and identify the year with the lowest number of manufacturing jobs nationwide, while noting to ignore years not present in the dataset.
Since the provided data for answer options is empty, there are no explicit choices to evaluate one by one. In situations like this, you should rely on the visual output (the plotted line) to determine which DataYear has the minimum Emp value.
Key idea 1: Read the plotted line accurately. The graph repre......Login to view full explanationLog in for full answers
We've collected over 50,000 authentic exam questions and detailed explanations from around the globe. Log in now and get instant access to the answers!
Similar Questions
What sort of chart could you create to compare data, where the data does not have to be in any specific order?
Lee needs to create a chart comparing sales for 21 regions. What sort of chart would be best?
When creating a dashboard for storytelling, which of the following is the best practice?
A large retail chain's quarterly report contains hundreds of pages of tables showing sales data by product, region, and store. Executives struggle to quickly grasp overall performance and identify key trends. Based on the sources, which benefit of data visualization would most directly address this challenge?
More Practical Tools for Students Powered by AI Study Helper
Making Your Study Simpler
Join us and instantly unlock extensive past papers & exclusive solutions to get a head start on your studies!