Tw tim hiéu cach stv dung phan mém: Nap Load df liéu, Bién ddi Transform Dataset, Làm sạch Clean di liệu, Kết hợp Mashup dữ liệu, Tạo mô hình Model dữ liệu, Mở rộng mô hình với các cột
Trang 1
KHOA CONG NGHE THONG TIN
6)
INDUSTRIAL
WU Aire
BAI TAP LON
HE THONG THONG MINH DOANH NGHIEP
21080031 Lê Hoàng Nhớ Nhóm trưởng
Trang 2Muc luc
1 Tìm hiểu công cu Microsoft Power BI Desktop: .0.ccccccccsssssscescssssssssescscscsevsvsvsvsssesevevesssssseseses 1
2 Sử dụng công cụ Microsoft Power BI Desktop để: (6đ) - ng 1
a Load, xử lý và trình bày dữ liệu là file Excel, Access, SQL Server (2 Ở) uc ky 1
b Load, xử lý và trình bày dữ liệu là kho dữ liệu (AdventureWorkDW2012, ) (2 đ) 53 c Load, xử lý và trình bày dữ liệu dạng khác (lấy từ website, facebook ) (2 đ) - 61
> Website on nh HH Hee 61
> Lấy dữ liệu Facebook -+222222222221111222111 1 reo 65
E2 9n cao 0n ốe 69
1 Tìm hiểu công cụ Microsoft Power BI Desktop:
a Download phan mém tai website:
https://www.microsoft.com/en-us/download/details.aspx?id=58494
b Tw tim hiéu cach stv dung phan mém: Nap (Load) df liéu, Bién ddi (Transform Dataset),
Làm sạch (Clean) di liệu, Kết hợp (Mashup) dữ liệu, Tạo mô hình (Model) dữ liệu, Mở rộng mô hình với các cột tính toán, Thêm Measures vào mô hình dữ liệu, Phân tích dữ liệu theo thời gian
c Truc quan hóa dữ liệu (Visualization) theo nhu cầu (dùng đề thị, bảng biểu)
2 Sử dụng công cụ Microsoft Power BI Desktop dé: (6d)
a Load, xtr ly va trinh bay dir liau Ia file Excel, Access, SQL Server (2 d)
>
1 Chuan bị dữ liệu trước khi làm
Trang 3g- SP Brenan BLQAAD ? a “ : tR*ưázm-,
Trang 4Online Services
> SharePoint folder Other
@ SQL Server Analysis Services database
Trang 5chọn bao gồm các bảng sau:
1 Order details: chứa thông tỉn về orderiD, productiD, unitPrice, quantity, discount
2 Products: chứa thông tin
về productiD, productName, quantityPerUnit, unitPrice, discontinued categoryID
3 Suppliers: chứa thông tin vé
Supplier!D, CompanyName, ContactName, ContactTitle, Address, City, Region, PostalCode, Country, Phone, Fax, Homepage
4 Categories: chira théng tin vé categoryID, categoryName, description
5 Orders: chứa thông tỉn
về orderlD, customeriD, employeelD, orderDate, requiredDate, shippedDate, shipper!
D, freight
6 Employees: chứa thông tin
vé employeelD, employeeName, title, city, country, reportsTo
Sau khi đã chọn ta nhấn tiếp vào Load để tiến hành phân tích
sewers
Display Options ~
P Quarterly Orders
Sales by Category
Sales Totals by Amount
Summary of Sales by Quarter
nside Sales Coordinato:
Sales Representative
TitleOfCourt:
Trang 6Ở bài phân tích này ta dùng Radial Bar Chart và sử dụng Slicers để chọn ra CategoryName (Tên danh mục sản phẩm), ProductName (Tên sản phẩm) và Country (Thành phố) Thao tác này sẽ hiển thị các chỉ số như Doanh sé trung binh (Average Sales) va Tổng doanh thu (Total Sales) cho các sản phẩm đã chon
Sau đó có thể sử dụng biểu đồ Histogram với trục ngang biểu thị năm ban hang (Order Date) va trục dọc biểu thị danh mục sản phẩm (CategoryName) để biểu diễn phân bố tần suất của doanh thu Cũng có thể sử dụng biểu đồ KDE (Kernel Density Estimation) để biểu diễn mật độ
và thông tin chỉ tiết về doanh số trung bình (Average Sales) cho một danh mục sản phẩm và phân phối trong một khoảng thời gian nhất định
Để bắt đầu ta sẽ chọn Slice và phần Data sẽ chọn các dữ liệu như các hình ảnh dưới
Trang 7>
EmployeelD Extension FirstName
HireDate
HomePhone LastName Notes PhotoPath PostalCode Region
Trang 9Excel Onelake S(
lñ là © LbBEä @ là EZ là RIAI t2
Tiếp theo ta sẽ thêm các cột mới để tính Doanh thu
hole nur - $-% EE pata category |U ' v| | Sortby
mnx
Để tính doanh thu từ bảng Order Details bằng cách sử dụng công thức sau:
Công thức doanh thu = Số lượng (Quantity) * Giá đơn vị (UnitPrice)
Công thức doanh thu thuần= Số lượng (Quantity) * Giá đơn vị (UnitPrice) * (1 - Chiết khấu
(Discount))
Cột này sẽ tính toán doanh thu cho mỗi dòng bằng cách nhân số lượng với đơn giá
Và thêm một cột để tính ngày giao hàng thành công:
DaysToShip = DATEDIFF(Orders[OrderDate], Orders[ShippedDate], DAY)
có chức năng tính số ngày giữa ngày đặt hàng và ngày giao hang cho mỗi đơn hàng trong bảng Orders.
Trang 12
Lần lượt chọn theo các thông tin như đã chon ở phần Card
11
Trang 1394/97/4986 2 06/05/1998 Z3
All v All ⁄ All
Tiếp theo để trực quan rõ hơn ta dùng Map để thể hiện thấy mức doanh thu ở quốc gia
il sỹ 8
Ri{IEI>fzE oO)
ContactName ContactTitle
Country CustomerID
> & Employees Legend Vv đồ, Order Details
Add data fields here () > Discount
Trang 15[] Quarter
14
Trang 16CategoryName ProductName x Country City
© Court of Orde @Sum of DosnhThuThuen
Trang 18w 4/or/igse [] 0s/05/1ggs F2 Sum of DoanhThuThuan
Count of OrderlD and Sum of DoanhThuThuan by Month
@ Count of Orden @ Sum of DoannTnuTnuan
Sesfood v Australia ~~ al v oaorisss GD 06/05/1996 E3
‘Sum of Discount Sum of Quantity Count of OrderlD ‘Sum of DoanhThu Sum of DoanhThuThuan
Count of OrderiD and Sum of DoanhThuThuan by Month
@ count of Orden @Sum of DoanhTnutnuan
Trang 191 Chuẩn bị dữ liệu trước khi làm
Dưới đây là bộ dữ liệu gồm thư viện phim và chương trình truyền hình phong phú của Netflix Với hơn 8000 tựa phim có sẵn trên nền tảng của họ:
18
Trang 20Fle Home Create External Data Database Tools Help Table Fields Table ƒ2 Tell me what you want to do
76 TV Show Midnight Mass Mike Fla: Kate Siegel, Zac September 24,
| Pr Movie My Little Pony: Rober Cullen, J Vanessa Hudger September:
98 Movie Sankots Haile Gerims — Kofi Ghanabe, C United Staten, CSeptember 24
17316 TV Show cow Peo Logan Browning United States
2322 TV Show Resurrection: E1 nen Alten Dar Turkey
| 24523 Movie Awvai Shanmug K.S Ravikumar Kamal Hassan, t
327 s26 WW Show: Love on the Spe poste See Satchww Australia
(Transform Dataset) va Làm sạch (Clean) dữ liệu
Từ màn hình chính ta chọn from another source và chọn Access database
Trang 21
Get Data
|a Excel Workbook All
£2—SOlL Server Analysis Seniices-datahase
Import data from a Microsoft Access database
Trang 23Horror, Thriller Animation,Comedy,F
Action,Adventure, Fa
Action,Adventure,Fa
Comedy Action,Adventure,Bi‹ Adventure,Drama,Rc
Action, Thriller Biography,Drama
Drama, Mystery,Sci-F Adventure,Drama,Th Drama Crime,Drama,Horror
>
Tai day ching ta s@ xoa cét khéng can thiét dé phan tich la Description (M6 ta)
22
Trang 24| my BB 4| ¥ [— _s«Data Type: Text *
x Jou Ee x TN =
Replace Values Transform
[Ei Merge Queries ~ © = Text Analytics
International TV Shows, TV Dramas, TV Mysteries
Crime TV Shows, Intemational! TV Shows, TV Action & Adventure
Docuseries, Reality TV
International TV Shows, Romantic TV Shows, TV Comedies
TV Dramas, TV Horror, TV Mysteries
Children & Family Movies
Dramas, Independent Movies, International Movies
British TV Shows, Reality TV
Comedies, Dramas
Crime TV Shows, Docuseries, International TV Shows
Crime TV Shows, International! TV Shows, TV Action & Adventure
On a photo shoot in Ghana, an American model slips back in time, bac
A talented batch of amateur bakers face off in a 10-week competition
Awoman adjusting to life after a loss contends with a feisty bird that's
Struggling to earn a living in Bangkok, a man joins an emergency rescu
»à[àE1 lạ
Trang 253 Bắt đầu xây dựng phân tích dữ liệu
Bây giờ chúng ta sẽ phân tích dựa theo:
e Bang điều khiển sẽ cung cấp giao diện tương tác của danh sách theo sự lựa chọn thể loại của người dùng
Trang 26
Get Excel Onelake SQL Enter Dataverse Recent Transform Refresh New Text More New Quick Pub
Clipboard Data Quenes insert Calculations Sensitivity Sh
Trang 27Count of show _id by release year and type
type @ Movie @TY Show
Tiếp theo chúng ta sẽ sử dụng biểu đồ thanh xếp dé thé hiện số lượng phim va chương trình
truyền hình theo thể loại
date_added director duration listed_in rating release_year show_id title
type
26
Trang 28
Count of show_id by release year and ty} Count of show_id by listed_in
Vẫn sử dụng biểu biểu đồ thanh xếp nhưng lần này sẽ hiển thị lượt đánh giá theo số lượng phim
và chương trình
€ount of show_¡d by release_year and type Count of show_id by listed_in
type @Nlovie @TV Show
Trang 29Visualizations >» Data »
Build visual
E lah E& hp E Inâ
Trang 30type @ Movie @TV Show
Trang 31Count of show_id by release_year and type
type @Movie @TV Show
show_id title
date_added
> release_year
MFirst show_id by country
Nem Bai TérDueng
Trang 33Count of show_id by release_year and type
type @Movie @TV Show
Band Aid
Up Among The Stars Pop, Lock ‘n Roll
director rating EDIB/EEENUNNLVEESEI Dramas, Interna 362 Zoy: Tan V1 xn TT 3:
Dramas Indepe as
Kids
4
Ví dụ chúng ta chọn quốc gia Việt Nam, sẽ hiện đầy đủ các chỉ số mà chúng ta đã chuẩn bị ở
bước trước
Count of title Count of rating Count of listed_in Count of director Min of release_year Max of release_year
Count of show_id by release_year and type ma ở 9 Count of show_id by Usted_in
Trang 34$ MadnatkeL Germany Montane None $2! $ 500 01032014 3
$9 ChannePartwess Canads Mertare None 29108 $ s00 (0106/2014 8
Financial Sample.xlsx
Nó chứa các dữ liệu tài chính như doanh thu, lợi nhuận, và chỉ phí, được phân loại theo các yếu
tố như khu vực, quốc gia, loại sản phẩm và năm
2 Nạp (Load) dữ liệu, Biến đổi (Transform Dataset) và Làm sạch (Clean) dữ liệu
Từ Power BI tiến hành nạp dữ liệu file đã chuẩn bị
33
Trang 35Add data to your report
oaded, your data will appear in the Data pane
Get data trom another source —x
Trang 36
Government Midmarket
Midmarket
Midmarket
Government
Midmarket Channel Partners Government Channel Partners
Midmarket
Enterprise Small Business
Government
Enterprise Midmarket
Government
Midmarket Channel Partners Government Channel Partners Government Midmarket
<
2
Country Canada
Germany
France Germany
Mexico
Germany Canada
France
Germany Mexico
Canada
Germany
Canada United States of America Canada Mexico
Canada Germany Germany
Mexico France
Product Carretera Carretera Carretera
Carretera
Carretera
Carretera
Montana Montana Montana
Montana
Montana
Montana
Montana Montana
Pasco Paseo
Paseo Paseo
Pasco
Paseo Paseo
Discount Band None None
None
None
None None
None None
None
None
None
None None
None None
None
None
None None
Un
dé chon Whole Number(sé
Trong trường hợp này, các đơn vị được bán ở dạng thập phân Không hợp lý khi có 0,2 hoặc 0,5 đơn vị được bán Vậy hãy đổi thành số nguyên
35
Trang 37form AddCokuma View = Tools Help
py Advanced Editor
Data settings Parameters* Preview
Data Sources Parameters Query
% = Table.TransformColumnTypes(financials Table,{{"Segment”, type text}, {"Count
Text True/False
Combine Fil Combine
Chọn cột Segment Chúng ta muốn làm cho các phân đoạn dễ nhìn hơn trong biểu đồ sau này,
vì vậy hãy định dạng cột Segment Trên tab Transform , chọn Format, sau đó chọn UPPERCASE
36
Trang 38Transform Add Column View Tools Help
ga Transpose Data Type: Text > _ Replace Values Sa Unpivot Columns
]Ƒ—
3 Midmarket Germany Carretera
6 Midmarket Germany Montana
10 Midmarket Mexico Montana
12 Small Business Mexico Montana
14 Enterprise Canada Montana
20 Channel Partners Germany Paseo
24 Midmarket Mexico Paseo
27 Channel Partners United States of America Paseo
Rút ngắn tên cột tty Month Name thanh Month Nhap dup vao cét Month Name va dé thanh Month
None None
None None
None
None
None None
None None
None None None
Trang 39Xoá dữ liệu không cần thiết:
Chọn cột cần xoá ở đây chung ta chon Discount Band(Trai phiếu) và chọn Removed Columns
38
Trang 40
1 GOVERNMENT Canada Carretera None 1618
5 MIDMARKET Mexico Carretera None 2470
12 ENTERPRISE Canada Montana None 2666
15 ENTERPRISE Canada Montana None 345
23 MIDMARKET France Paseo None 549
Trang 41đÏ ' G = | Untitled - Power Query Editor
Home Transform Add Column View
us| Le LO EE Le
mt LC) <>
Close & New Recent Enter Data source Manage
Apply” Source’ Sources* Data settings Parameter:
Close New Query Data Sources Parametet
1 financials FT, AB segment
1 GOVERNMENT
2 GOVERNMENT
3 Tién hành thao tác với dữ liệu:
Tạo cột tính toán với dữ liệu
Trên thanh Home , chọn New measure
x SY | |1 Total Units Sold = SUM(financia1s[Units Sold])|
40
Trang 42Bây giờ hãy chọn biểu tượng chế độ xem Bảng ở bên trái Và Trên thanh Home, chọn New
Clipboard Data Queries Relationships Calculations
hull
SOVERNMENT Germany Carretera None 1513 3 350 529550
Nhập biểu thức này để tạo bảng Lịch gồm tất cả các ngày từ ngày 1 tháng 1 năm 2013 đến ngày
31 tháng 12 năm 2014
Sau đây là 23 hàng đầu tiên của bảng một cột mà bạn vừa tạo
41
Trang 43Bây giờ hãy chọn chế độ xem Model ở bên trái
1 Calendar = CALENDAR(DATE(2013,01,01) ,Date(2014,12,31))
Trang 44
Kéo trường Date từ bảng financials vào trường Date trong bảng Calendar để nối các bảng và tạo
mối quan hệ giữa chúng
43
Trang 454 Bat dau xay dung phan tich di? liéu:
Ở thanh bên trái, chọn Report view
44
Trang 461 Từ thanh Data bên phải, chọn trường Profit (Lợi nhuận)
2 Chọn trường Date(Ngày) Nếu bạn đã tạo bảng Calendar(Lịch) hãy kéo trường Date từ bảng Lịch
Trang 47Đầu tiên chúng ta thấy rằng năm 2014 lợi nhuận cao nhất
Tiếp theo để có thể xem chỉ tiết hơn ta chọn vào năm 2014 và nhấn vào biểu tượng mũi tên như
hình để có thể xem lợi nhuận theo từng quý trong năm 2014
46
Trang 49Ta có thể thấy ở năm 2014 thì ở quý 4 có lợi nhuận cao nhất, tiếp theo để xem ở quý 4 thì có
tháng nào lợi nhuận đạt cao nhất
48