2 Vinaytech Power Bi Basic Practicals All Feeds
2 Vinaytech Power Bi Basic Practicals All Feeds
Trainings:
CLASS ROOM
VIDEOS ONLINE
PROVIDED
FAST TRACK
ONE ON ONE
PROJECT TRAINING
Address:
Flat No: 506/B
Nilgiri Block
Aditya Enclave
Mytrivanam Area
a) Power BI End-End steps
Hyderabad.
b) Getting Data From Flat file
c) Getting Data From Excel
d) Getting Data From Web
Website & Blog
www.vinaytechhouse.com
e) Working with Databases [Using Query, View, Function www.msbivinay.blogspot.in
and Procs]
f) Working on Import and Direct Query Modes Contact Information
g) Working with Analysis Services Cubes [Tabular ] +91 9573168449
Working on Import and Connect Live 040 66638869
h) Working with JSON
i) Working with Lists (Blank Query)
j) Working with Mashup to generate a query
k) Create table using DAX
l) Working with Azure SQL Database [Cloud]
m) Dynamically creating table
n) Working on same structured files and merge
Note:
This document is for queries creation from possible
feeds
#506-B, Nilgiri Block, Aditya Enclave, Ameerpet, Hyd. Ph: 040 66638869/ 9573168449
POWER BI ALL DATA FEEDS PRACTICE [VIDEO ASSISTANCE REQUIRED] 2
Scenario: Getting data from Flat file, Generate Report, and publish it.
Open Desktop
Get Data--> Text/ Csv--> Browse to file [Party_Src.csv]
File Origin: Country and Code page [Language charset]
Delimiter: Separator in the file data [comma, space, tab space, pipe etc...]
Data type Detection: First 200 rows [Default option]
System identifies the data type based on first 200 rows of the column values.
Ex:
Assume you have 1000 records, first 200 are textual data next 200 are dates and the other are
numeric. It will take Textual data because of first 200 columns
Real-time usage: If we detect properly, you can apply calculations easily [Normal and DAX].
Go to Data view and see the accuracy of data, if it not good then go for Edit Queries to move
into Power Query Area [ETL Area where it load and operates in in memory using Vertipaq
engine]
Queries--> Right Click--> Remove Top Rows (2) -->Step1 added in the right-hand side
Right Click--> Use First Row as Headers → Step2 added in the right-hand side
Close and Apply
Go to Report view, take table and drag and drop fields [PARTYID, PARTYNAME, PARTYLOC and
PARTYINCOME] from field’s pane into Values section.
Ensure aggregation unchecked (Sum or Avg or Count etc...) for PARTYID, PARTYNAME,
PARTYLOC AND PARTYINCOME.
#506-B, Nilgiri Block, Aditya Enclave, Ameerpet, Hyd. Ph: 040 66638869/ 9573168449
POWER BI ALL DATA FEEDS PRACTICE [VIDEO ASSISTANCE REQUIRED] 3
[Vinaytech_Business_Details_Dataset.xls]
Get Data--> Excel-->Browse to the file--> Tick mark the below dimension and fact tables
DimDate,DimCourse, DimCourseModeID, DimLocation, DimStudent and FactPayments
Always dataset require columns and values [No aggregate information or any], please apply
transformations to make that data as proper columnar data.
Observations:
We never maintain row level aggregate data, so remove those Sub values.
We never maintain date values column wise, so transpose / convert columns to rows [Unpivot]
Get data--> Excel--> Browse to Excel file (Budget.xls)--> Choose the Sheet--> Edit -->
Implement the below
#506-B, Nilgiri Block, Aditya Enclave, Ameerpet, Hyd. Ph: 040 66638869/ 9573168449
POWER BI ALL DATA FEEDS PRACTICE [VIDEO ASSISTANCE REQUIRED] 4
1) Row Transformations
2) Column Transformations
Highlight first four columns --> right click--> Unpivot other columns, so that Month column
values converted into Row Values.
#506-B, Nilgiri Block, Aditya Enclave, Ameerpet, Hyd. Ph: 040 66638869/ 9573168449
POWER BI ALL DATA FEEDS PRACTICE [VIDEO ASSISTANCE REQUIRED] 5
a) DAX language code [DATA ANALYSIS EXPRESSIONS: Suitable for Modeling and
Analysis]
b) Mashup language code [M-Language code: Suitable for Extraction and
Transformation]
Power BI Languages
Purpose:
What we do?
What it contains?
#506-B, Nilgiri Block, Aditya Enclave, Ameerpet, Hyd. Ph: 040 66638869/ 9573168449
POWER BI ALL DATA FEEDS PRACTICE [VIDEO ASSISTANCE REQUIRED] 6
Purpose:
What we do?
What it contains?
Scenario: Create a list [Mashup] and convert to table using Blank Query
Now it will generate a list with the values between 2005 and 2025.
To convert to table, home ribbon →click TO Table icon and press ok.
#506-B, Nilgiri Block, Aditya Enclave, Ameerpet, Hyd. Ph: 040 66638869/ 9573168449
POWER BI ALL DATA FEEDS PRACTICE [VIDEO ASSISTANCE REQUIRED] 7
#506-B, Nilgiri Block, Aditya Enclave, Ameerpet, Hyd. Ph: 040 66638869/ 9573168449
POWER BI ALL DATA FEEDS PRACTICE [VIDEO ASSISTANCE REQUIRED] 8
Modeling menu→New Table→ and specify the below in the function / expression area→click
save
Modeling menu→New Table→ and specify the below in the function / expression area→click
save
#506-B, Nilgiri Block, Aditya Enclave, Ameerpet, Hyd. Ph: 040 66638869/ 9573168449
POWER BI ALL DATA FEEDS PRACTICE [VIDEO ASSISTANCE REQUIRED] 9
Modeling menu→New Table→ and specify the below in the function / expression area→click
Save
Date_Table =
ADDCOLUMNS
(
CALENDAR(date(2019,01,01),date(2020,01,01)),
"year",year([Date]),
"month",Month([Date]),
"day", day([Date]),
"quarter", "Q" & quarter([Date]),
"hour", hour([Date]),
"minute",minute([Date]),
"Year FullMonth", Format([Date], "YYYY MMMM"),
"Year Month Short",Format([Date], "YY MMM"),
"Day,month, year", Format([Date], "DDDD,MM,YYYY"),
"today date and time",now()
)
#506-B, Nilgiri Block, Aditya Enclave, Ameerpet, Hyd. Ph: 040 66638869/ 9573168449
POWER BI ALL DATA FEEDS PRACTICE [VIDEO ASSISTANCE REQUIRED] 10
Click Table icon in the home menu at Power BI Desktop, enter the below rows, provide table
name and click Ok
WORKING ON DATABASES
#506-B, Nilgiri Block, Aditya Enclave, Ameerpet, Hyd. Ph: 040 66638869/ 9573168449
POWER BI ALL DATA FEEDS PRACTICE [VIDEO ASSISTANCE REQUIRED] 11
File 1:
File 2:
Eid, Ename, Eloc
3,x,mum
4,y,mum
File 3:
Eid, Ename, Eloc
5,x,blore
6,y,blore
Practical:
Go to Power Bi Desktop→ Get Data→ Folder→ displays all files, show click
#506-B, Nilgiri Block, Aditya Enclave, Ameerpet, Hyd. Ph: 040 66638869/ 9573168449
POWER BI ALL DATA FEEDS PRACTICE [VIDEO ASSISTANCE REQUIRED] 12
Relational Databases:
Cube Databases:
MSBI-SSAS [Multidimensional & Tabular], SAP Netviewer, SAP HANA, Hyperion Cubes etc.
NO SQL Database:
It requires
a) SQL Server Database Engine Installation
b) SQL Server Management Studio [SSMS]
This studio is suitable to work with multiple databases [Normal, Cube, DQ, MDS etc.]
Note: Install the above by following the video and Installation Documents.
#506-B, Nilgiri Block, Aditya Enclave, Ameerpet, Hyd. Ph: 040 66638869/ 9573168449
POWER BI ALL DATA FEEDS PRACTICE [VIDEO ASSISTANCE REQUIRED] 13
USE DB_Jan_2021;
/*
Example:
*/
#506-B, Nilgiri Block, Aditya Enclave, Ameerpet, Hyd. Ph: 040 66638869/ 9573168449
POWER BI ALL DATA FEEDS PRACTICE [VIDEO ASSISTANCE REQUIRED] 14
/*
Create Table:
*/
Create table emp(eid integer, enm varchar(30), jdate date,esal money, did
smallint)
(2,'mno','2021-02-02',20000,20),
(3,'klr','2021-02-03',40000,30),
(4,'trv','2021-02-02',20000,20),
(5,'uoi','2021-02-04',50000,10)
Create table hr.emp(eid integer, enm varchar(30), jdate date,esal money, did
smallint)
#506-B, Nilgiri Block, Aditya Enclave, Ameerpet, Hyd. Ph: 040 66638869/ 9573168449
POWER BI ALL DATA FEEDS PRACTICE [VIDEO ASSISTANCE REQUIRED] 15
(11,'mno','2021-02-02',20000,20),
(12,'klr','2021-02-03',40000,30),
(13,'trv','2021-02-02',20000,20),
(14,'uoi','2021-02-04',50000,10)
belongs to dept 10
#506-B, Nilgiri Block, Aditya Enclave, Ameerpet, Hyd. Ph: 040 66638869/ 9573168449
POWER BI ALL DATA FEEDS PRACTICE [VIDEO ASSISTANCE REQUIRED] 16
a) To work on multiple objects which are having same structure, we go for set
theory [Structure indicates--same number of columns, and same data type
order]
Union
Union ALL
Intersect
Except
#506-B, Nilgiri Block, Aditya Enclave, Ameerpet, Hyd. Ph: 040 66638869/ 9573168449
POWER BI ALL DATA FEEDS PRACTICE [VIDEO ASSISTANCE REQUIRED] 17
/* Join mechanism:
Ex: I want emp columns, dept columns in a single area, then we go for joins.
While getting columns from another table, we may go for condition or non-
condition, based on this we are having 3 types of joins
--> Sub types EQUI Join, Non EQUI Join, SELF Join etc...
*/
--Getting columns from emp and dept with did condition [matched data]
--This will give you employees who all having valid departments
--Getting columns from emp and dept with did condition [matched data]
--Get values from emp who all not having valid depts [Unmatched]
--Getting columns from emp and dept with did condition [matched data]
--Get values from dept who all not having valid employees [Unmatched]
#506-B, Nilgiri Block, Aditya Enclave, Ameerpet, Hyd. Ph: 040 66638869/ 9573168449
POWER BI ALL DATA FEEDS PRACTICE [VIDEO ASSISTANCE REQUIRED] 18
--Getting columns from emp and dept with did condition [matched data]
--Get values from dept who all not having valid employees and employees not
having valid
--departments [Unmatched]
/* Views:
*/
Syn:
Ex:
--calling view
#506-B, Nilgiri Block, Aditya Enclave, Ameerpet, Hyd. Ph: 040 66638869/ 9573168449
POWER BI ALL DATA FEEDS PRACTICE [VIDEO ASSISTANCE REQUIRED] 19
as
--calling view
as
--calling view
as
#506-B, Nilgiri Block, Aditya Enclave, Ameerpet, Hyd. Ph: 040 66638869/ 9573168449
POWER BI ALL DATA FEEDS PRACTICE [VIDEO ASSISTANCE REQUIRED] 20
/*
Function
operations
e) We have system defined functions [Ex: Upper, Lower, Trim etc..] and user
defined functions
*/
Syn:
returns table
#506-B, Nilgiri Block, Aditya Enclave, Ameerpet, Hyd. Ph: 040 66638869/ 9573168449
POWER BI ALL DATA FEEDS PRACTICE [VIDEO ASSISTANCE REQUIRED] 21
/* Procedure
[when you create procedure, system compiles and stores compiled body.
re-compilation]
result [optional]
*/
Syn:
as
Begin
Body
Return --optional
End;
Ex:
--Create a simple procedure to get all rows from emp table
create procedure pr
as
Begin
End;
#506-B, Nilgiri Block, Aditya Enclave, Ameerpet, Hyd. Ph: 040 66638869/ 9573168449
POWER BI ALL DATA FEEDS PRACTICE [VIDEO ASSISTANCE REQUIRED] 22
--calling a procedure
Execute pr
as
Begin
End;
Execute pr1 10
--Create a simple procedure and pass input parameters and get output
parameter
as
Begin
End;
print @dname
#506-B, Nilgiri Block, Aditya Enclave, Ameerpet, Hyd. Ph: 040 66638869/ 9573168449
POWER BI ALL DATA FEEDS PRACTICE [VIDEO ASSISTANCE REQUIRED] 23
--Create a simple procedure and pass input parameters and get output
as
Begin
return @cnt;
End;
print @dname
Print @count
Interview Oriented:
a) DML operations
b) Set theory
c) Joins
d) Views
e) Procedures
f) Functions
Refer to the check list given for you...there you will see
#506-B, Nilgiri Block, Aditya Enclave, Ameerpet, Hyd. Ph: 040 66638869/ 9573168449
POWER BI ALL DATA FEEDS PRACTICE [VIDEO ASSISTANCE REQUIRED] 24
SELECT STATEMENT
Tables
[Data-All
Locations ]
Operations [Permanent /
Temporary] Procedure [many statements]
Result [optional]
Operations [Permanent /
Temporary] Functions [many statements]
Return result [compulsory]
#506-B, Nilgiri Block, Aditya Enclave, Ameerpet, Hyd. Ph: 040 66638869/ 9573168449
POWER BI ALL DATA FEEDS PRACTICE [VIDEO ASSISTANCE REQUIRED] 25
Import
Database Views:
c) When we call view (using simple select), it hits the database and execute the select statement
inside body and retrieves data.
#506-B, Nilgiri Block, Aditya Enclave, Ameerpet, Hyd. Ph: 040 66638869/ 9573168449
POWER BI ALL DATA FEEDS PRACTICE [VIDEO ASSISTANCE REQUIRED] 26
Calling:
Scenario: Getting data from SQL Server Database and Generate Report from Views.
b) Second way:
#506-B, Nilgiri Block, Aditya Enclave, Ameerpet, Hyd. Ph: 040 66638869/ 9573168449
POWER BI ALL DATA FEEDS PRACTICE [VIDEO ASSISTANCE REQUIRED] 27
Database Procedures
a) Precompiled object with collection of statements, so at run time it will not compile and
directly participate in execution.
Ex: One table structure changed, if we use procedure in Power BI we need not get those
changes. Procedure will take care of it.
Differences between view,
procedure and function?
#506-B, Nilgiri Block, Aditya Enclave, Ameerpet, Hyd. Ph: 040 66638869/ 9573168449
POWER BI ALL DATA FEEDS PRACTICE [VIDEO ASSISTANCE REQUIRED] 28
#506-B, Nilgiri Block, Aditya Enclave, Ameerpet, Hyd. Ph: 040 66638869/ 9573168449
POWER BI ALL DATA FEEDS PRACTICE [VIDEO ASSISTANCE REQUIRED] 29
Scenario: Getting data from SQL Server Database and Generate Report from Procedure.
Import
Advanced tab
Command timeout in minutes: 30 (After 30 minutes query execution aborted)
Note: While we are using Import Mode, You can't take sources of other modes [Connect Live
and Direct Query]
But you can add as many as possible and from heterogeneous applications to import mode
Dataset.
#506-B, Nilgiri Block, Aditya Enclave, Ameerpet, Hyd. Ph: 040 66638869/ 9573168449
POWER BI ALL DATA FEEDS PRACTICE [VIDEO ASSISTANCE REQUIRED] 30
1st Way:
2nd Way:
Get data->SQL Server->Import -> go to advanced specify timeout and write query-> Load
1st Way:
2nd Way:
Get data->SQL Server-> Direct Query-> go to advanced specify timeout and write query->
Load
1st Way: Get data->SQL Server Analysis Services-> Connect Live-> choose tables-> Load
#506-B, Nilgiri Block, Aditya Enclave, Ameerpet, Hyd. Ph: 040 66638869/ 9573168449
POWER BI ALL DATA FEEDS PRACTICE [VIDEO ASSISTANCE REQUIRED] 31
2nd Way:
Get data->SQL Server Analysis Services-> Connect Live-> Go to advanced specify MDX query
for Multidimensional model/ DAX for Tabular model> Load
What are the things we need to collect when we work with cubes?
a) Multidimensional cube
1) Server name 2) Cube database name 3) Tables or MDX query
MDX—Multidimensional Expressions
b) Tabular cube
1) Server name 2) Cube database name 3) Tables or DAX query
DAX—Data Analysis Expressions
#506-B, Nilgiri Block, Aditya Enclave, Ameerpet, Hyd. Ph: 040 66638869/ 9573168449
POWER BI ALL DATA FEEDS PRACTICE [VIDEO ASSISTANCE REQUIRED] 32
#506-B, Nilgiri Block, Aditya Enclave, Ameerpet, Hyd. Ph: 040 66638869/ 9573168449
POWER BI ALL DATA FEEDS PRACTICE [VIDEO ASSISTANCE REQUIRED] 33
To work with Azure [SQL Database / SQL Warehouse / Analysis Services], know the below
entries.
a) Azure servername where it installed
b) Databasename
c) Credentials [ Azure active directory credentials or SQL Credentials]
In Power BI DESKTOP
Get data→ Azure SQL Database / SQL Server Database → Specify Server Name and Database→
OK→Choose tables →
Note: See the below to recognize the Azure Server and Database name.
#506-B, Nilgiri Block, Aditya Enclave, Ameerpet, Hyd. Ph: 040 66638869/ 9573168449
POWER BI ALL DATA FEEDS PRACTICE [VIDEO ASSISTANCE REQUIRED] 34
#506-B, Nilgiri Block, Aditya Enclave, Ameerpet, Hyd. Ph: 040 66638869/ 9573168449
POWER BI ALL DATA FEEDS PRACTICE [VIDEO ASSISTANCE REQUIRED] 35
#506-B, Nilgiri Block, Aditya Enclave, Ameerpet, Hyd. Ph: 040 66638869/ 9573168449
POWER BI ALL DATA FEEDS PRACTICE [VIDEO ASSISTANCE REQUIRED] 36
Use Sample.xlsx to
generate report Get Data--> Files--> Excel
Use Budget.xlsx to
generate report Get Data--> Files--> Excel
SQL Server Import Mode Get Data--> SQL Server Database, choose Import Mode
SQL Server Database Get Data--> SQL Server Database, Import / Direct Query, but
Procedure Data Advanced option and SQL Command area is required
Analysis Services Connect Get Data--> SQL Server Analysis Services, choose mode Connect
Live Live
Analysis Services Import Get Data--> SQL Server Analysis Services, choose mode Import
Get Data--> Files--> Web-->URL
#506-B, Nilgiri Block, Aditya Enclave, Ameerpet, Hyd. Ph: 040 66638869/ 9573168449
POWER BI ALL DATA FEEDS PRACTICE [VIDEO ASSISTANCE REQUIRED] 37
Getting Data from JSON Get Data--> Files-->JSON a) Read like List b) Convert to
File table c) Expand columns to show like table
Getting Data from Blank Get Data--> Blank Query--> Expression Bar
Query [=List.Numbers(2000,25)]
Difference between Query Query contain multiple columns, whereas List contain single
and List? column.
#506-B, Nilgiri Block, Aditya Enclave, Ameerpet, Hyd. Ph: 040 66638869/ 9573168449
POWER BI ALL DATA FEEDS PRACTICE [VIDEO ASSISTANCE REQUIRED] 38
Down status bar in the dataset, mode change is visible, you can do.
Yes, possible.
Go to edit queries, left hand side, hold top query, hold shift query and click on the
#506-B, Nilgiri Block, Aditya Enclave, Ameerpet, Hyd. Ph: 040 66638869/ 9573168449
POWER BI ALL DATA FEEDS PRACTICE [VIDEO ASSISTANCE REQUIRED] 39
c) Power BI uses a Powerful Engine called “Vertipaq” which is used to process the data in the
memory.
#506-B, Nilgiri Block, Aditya Enclave, Ameerpet, Hyd. Ph: 040 66638869/ 9573168449