0% found this document useful (0 votes)
197 views40 pages

2 Vinaytech Power Bi Basic Practicals All Feeds

1) The document provides training on various IT topics including Power BI and describes the training methods like classroom, online videos, and one-on-one sessions. 2) It lists the various Power BI topics that will be covered including retrieving different types of data, data modeling, report creation, and dashboards. 3) Examples of retrieving and transforming data from sources like the web, flat files, Excel, and JSON are provided and steps are described to create reports and publish them for use.

Uploaded by

Ss
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
197 views40 pages

2 Vinaytech Power Bi Basic Practicals All Feeds

1) The document provides training on various IT topics including Power BI and describes the training methods like classroom, online videos, and one-on-one sessions. 2) It lists the various Power BI topics that will be covered including retrieving different types of data, data modeling, report creation, and dashboards. 3) Examples of retrieving and transforming data from sources like the web, flat files, Excel, and JSON are provided and steps are described to create reports and publish them for use.

Uploaded by

Ss
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 40

IT Real-Time training that work for your career.

PROVIDED TRAINING FOR THOUSANDS OF STUDENTS .


SUBJECT, MATERIAL & VIDEOS

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

WE’VE WORKED WITH A DIVERSE CUSTOMER BASE. HOW CAN WE HELP


YOU?
IT Training, Support and Consulting.
POWER BI ALL DATA FEEDS PRACTICE [VIDEO ASSISTANCE REQUIRED] 1

POWER BI BASIC REPORTS PRACTICE [END-END] WITH MOST OF THE DATA


SOURCES [FEEDS]

POWER BI END – END PROCESS

a) RETRIEVE DATA [structured, semi structured, and unstructured]


b) Shape Data [Shaping]
c) Model Data [Modelling]
d) Report Data [Reporting]
e) Publish Report [Publishing]
f) Create Dashboard and mobile reports
g) Share or subscribe reports and dashboards
h) Access the reports and dashboard for customer decision making, analysis, analytics
and insights.
i) Customer Reviews to the designers and other colleagues

#506-B, Nilgiri Block, Aditya Enclave, Ameerpet, Hyd. Ph: 040 66638869/ 9573168449
POWER BI ALL DATA FEEDS PRACTICE [VIDEO ASSISTANCE REQUIRED] 2

Scenario: Retrieving data from Web Site / Blog URL

a) Identify the URL and Tables


b) Get Data-->Web--> http://www.vinaytechhouse.com/register-today.html
c) Choose Tables [Document ignore]
d) Load [ this will take structure and data]

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].

Click Load [ this will take structure and data]

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

PARTYID, PARTYNAME and PartlyLoc -> Don't summarize


Partyincome--Sum
Format Options [As you wish]
Home menu--> Publish

Go to Power BI cloud [app.powerbi.com], connect, My Workspace, Reports→See the


report

What are the objects have Focus Mode?

Only Visual and Book mark

Scenario: Getting data from Excel and Generate Report.

[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

Scenario: Getting data from Excel and Generate Report. [Budget.xls]

Open the sheet and observe.

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

a) Remove top 2 rows


b) Use first row as headers
c) Go to First Column [Ex: category] -->Rc-->Filter-->Uncheck the SubTotalCategory,
SubTotalBikes, SubTotalCloths and GrandTotal boxes

2) Column Transformations

Highlight first four columns --> right click--> Unpivot other columns, so that Month column
values converted into Row Values.

Scenario: Create a query by retrieving from JSON file [Semi structured]

JSON: Java Structured Object Notation

1.Semi Structured file


2.Contains Attributes and Properties
3.System reads in a different way, so we need to handle based on the situation.

1) Get Data→ specify other options→JSON→ Choose products.json file


2) Click on List, s that it will show you records in a column
3) Click to table on top
4) Go to the expand symbol→click→choose columns [all or required], now the table is
expanded.

#506-B, Nilgiri Block, Aditya Enclave, Ameerpet, Hyd. Ph: 040 66638869/ 9573168449
POWER BI ALL DATA FEEDS PRACTICE [VIDEO ASSISTANCE REQUIRED] 5

Generating table using coding

There are two ways

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

Power BI uses two types of languages majorly

a) DAX [ Data Analysis Expression] Language

Purpose:

This is helpful to model and analyze data.

What we do?

It creates new measures (single value component) / new columns


(multiple values in a column) / new table (multiple columns in a table)

What it contains?

Similar to other languages it has elements (operators, keywords,


functions, data types etc...)

Mostly we use functions in the DAX [Functional or Formula language]

#506-B, Nilgiri Block, Aditya Enclave, Ameerpet, Hyd. Ph: 040 66638869/ 9573168449
POWER BI ALL DATA FEEDS PRACTICE [VIDEO ASSISTANCE REQUIRED] 6

b) Mashup Language [M-Lang]

Purpose:

Helps us to implement extraction and transformation operations

What we do?

This helps to work with columns and rows.

What it contains?

It contains multiple elements and a programming hierarchy [ It is a


programming language]

Mashup contains multiple Libraries, Libraries contain classes, classes contain


methods.

Library---> Class--> Method

Scenario: Create a list [Mashup] and convert to table using Blank Query

Get data--> Blank Query--> Expression bar =List.Numbers(2005,20)

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.

Note: Add columns and write expressions to get desired result

#506-B, Nilgiri Block, Aditya Enclave, Ameerpet, Hyd. Ph: 040 66638869/ 9573168449
POWER BI ALL DATA FEEDS PRACTICE [VIDEO ASSISTANCE REQUIRED] 7

Scenario: Create a table by writing M (Mashup) steps at Blank Query

a) Place the file Party_SRC.csv from Lab backup folder to C:\Data

b) Get Data--> Blank Query--> Advanced Editor→ place like below


GetParty = Csv.Document (File. Contents ("C:\DATA\PARTY_SRC.csv"),[Delimiter=",", Columns=5,
Encoding=1252, QuoteStyle=QuoteStyle.None])

#506-B, Nilgiri Block, Aditya Enclave, Ameerpet, Hyd. Ph: 040 66638869/ 9573168449
POWER BI ALL DATA FEEDS PRACTICE [VIDEO ASSISTANCE REQUIRED] 8

Scenario: Create a table using DAX functions

Modeling menu→New Table→ and specify the below in the function / expression area→click
save

Scenario: Create a table using DAX function DATATABLE

Modeling menu→New Table→ and specify the below in the function / expression area→click
save

Emp Table= DATATABLE ("EMPID", INTEGER,"EMPNAME", STRING, {{1,"x"}, {2,"y"}})

#506-B, Nilgiri Block, Aditya Enclave, Ameerpet, Hyd. Ph: 040 66638869/ 9573168449
POWER BI ALL DATA FEEDS PRACTICE [VIDEO ASSISTANCE REQUIRED] 9

Create A Date Table using DAX Expression

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

Scenario: Create a table Dynamically at Desktop / Query

Click Table icon in the home menu at Power BI Desktop, enter the below rows, provide table
name and click Ok

WORKING ON DATABASES

Database: A storage area where data stored in the form of tables.

#506-B, Nilgiri Block, Aditya Enclave, Ameerpet, Hyd. Ph: 040 66638869/ 9573168449
POWER BI ALL DATA FEEDS PRACTICE [VIDEO ASSISTANCE REQUIRED] 11

Scenario: Create multiple files with same structure and combine

Create three files with same structure

File 1:

Eid, Ename, Eloc


1,x,che
2,y,che

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

“Combine” to combine files data and load.

#506-B, Nilgiri Block, Aditya Enclave, Ameerpet, Hyd. Ph: 040 66638869/ 9573168449
POWER BI ALL DATA FEEDS PRACTICE [VIDEO ASSISTANCE REQUIRED] 12

DATABASES AND USAGE IN REAL-TIME AND POWER BI PROJECTS

There are three types of databases

a) Relational Database [Data in the form of normal tables]


b) Multidimensional Database [Data in the form of dimension and fact tables in a cube]
c) No SQL Databases [Data in the form of files and other formats]

Relational Databases:

Oracle, SQL Server, Teradata etc.

Cube Databases:

MSBI-SSAS [Multidimensional & Tabular], SAP Netviewer, SAP HANA, Hyperion Cubes etc.

NO SQL Database:

Dynamo DB, Mongo DB etc.

Working on SQL Server Database [Simple Practice]

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

Important points to remember:

a) To work with Relational databases, we need SQL [Structured Query Language]


b) To work with Multidimensional databases, we need MDX [Multidimensional Expression
Language]
c) To work with Tabular databases, we need DAX [Data Analysis Expression]

Working on SQL Server Database [Simple Practice]

Open SQL Server Management Studio→ Server Type: Database Engine→Connect,


Click on New Query and execute each statement by pressing F5 or clicking execute icon.

--Create database [storage creation inside instance/server]

--Creating database [physical storage area]

Create Database DB_Jan_2021;

--Using the above database for operations

USE DB_Jan_2021;

/*

Creating schema [logical component to hold objects which is suitable


to keep specific business information

Example:

Human Resource information in HR schema


Payment information in Payments schema

*/

Create schema HR;

#506-B, Nilgiri Block, Aditya Enclave, Ameerpet, Hyd. Ph: 040 66638869/ 9573168449
POWER BI ALL DATA FEEDS PRACTICE [VIDEO ASSISTANCE REQUIRED] 14

/*

Create Table:

a)Table is a two dimensional object with rows and columns.

b)Table is heart of a database

c)On top of table / tables, we perform operations using Views, Procedures,

and Functions. It also allows different topics to implement business logics

[Sub queries, Joins, Set Operations, CTE etc...]

*/

Create table emp(eid integer, enm varchar(30), jdate date,esal money, did

smallint)

--Insert single row to the table

Insert into emp values(1,'xyz','2021-02-01',30000,10);

--Inserting multiple records in to the table

Insert into emp values

(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)

--Retrieve infromation from table (all columns (technically we use *)

select * from dbo.emp

--Note: If we don't mention any schema, default is 'dbo' [Database Object]

--Creating same emp table under HR schema

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

--Inserting rows into HR emp table

Insert into hr.emp values

(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)

Insert into hr.emp values(1,'xyz','2021-02-01',30000,10);

--Retrieve eid,ename,did from table (all columns (technically we use *)

select eid,enm, did from dbo.emp

--Retrieve infromation from table (all columns (technically we use *) who

belongs to dept 10

select * from dbo.emp where did=10

--Creating another table which holds dept data

Create table dept(did integer, dnm varchar(30))

--Insert rows in to dept table

insert into dept values(10,'IT'),(20,'Hr'),(30,'Sales')

--Retrieving data from dept table

select * from dept

#506-B, Nilgiri Block, Aditya Enclave, Ameerpet, Hyd. Ph: 040 66638869/ 9573168449
POWER BI ALL DATA FEEDS PRACTICE [VIDEO ASSISTANCE REQUIRED] 16

/* Set theory implementation in SQL Server

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]

b) There are four operators

Union: Combine rows [No duplicates]

Union ALL: Combine rows with duplicates

Intersect: [Common rows]

Except / Minus: [Exclusive Rows]


*/

--Combining rows without duplicates [UNION implementation]

select * from dbo.emp

Union

select * from hr.emp

--Combining rows with duplicates [UNION ALL implementation]

select * from dbo.emp

Union ALL

select * from hr.emp

--Common rows between tables [Intersect implementation]

select * from dbo.emp

Intersect

select * from hr.emp

--Exclusive rows from dbo.emp table [Except implementation]

select * from dbo.emp

Except

select * from hr.emp

#506-B, Nilgiri Block, Aditya Enclave, Ameerpet, Hyd. Ph: 040 66638869/ 9573168449
POWER BI ALL DATA FEEDS PRACTICE [VIDEO ASSISTANCE REQUIRED] 17

/* Join mechanism:

Joins to bring multiple columns from multiple tables

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

a) No condition join [CROSS JOIN]

b) Condition Join [INNER JOIN]

--> Sub types EQUI Join, Non EQUI Join, SELF Join etc...

c) Condition matched and Unmatched Join [Outer Join]

--> Sub Types, Left Outer Join, Right Outer Join,


Full Outer Join

*/

--Getting columns from emp and dept without condition

select e.*,d.* from emp e

CROSS JOIN Dept d

--Getting columns from emp and dept with did condition [matched data]

--This will give you employees who all having valid departments

select e.*,d.* from emp e

INNER JOIN Dept d on e.did=d.did

--Getting columns from emp and dept with did condition [matched data]

--Get values from emp who all not having valid depts [Unmatched]

select e.*,d.* from emp e

LEFT JOIN Dept d on e.did=d.did

--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

select e.*,d.* from emp e

RIGHT JOIN Dept d on e.did=d.did

--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]

select e.*, d.* from emp e

FULL JOIN Dept d on e.did=d.did

/* Views:

a) View is a logical object for physical collection of tables.

b) Views restrict rows and columns from table / tables

c) Mainly for Row Level Security On Data, we go for Views

d) Views contain single Select statement without semicolon and Order by

e) Views do not support arguments (parameters)

*/

Syn:

Create view <viewname> as


(
select statement
)

Ex:

--create view to get dept 10 data

Create view vw_dept10


as
select * from emp where did=10;

--calling view

select * from vw_dept10

#506-B, Nilgiri Block, Aditya Enclave, Ameerpet, Hyd. Ph: 040 66638869/ 9573168449
POWER BI ALL DATA FEEDS PRACTICE [VIDEO ASSISTANCE REQUIRED] 19

--create view to get dept 20 data

Create view vw_dept20

as

select * from emp where did=20;

--calling view

select * from vw_dept20

--create view to get dept 30 data

Create view vw_dept30

as

select * from emp where did=30;

--calling view

select * from vw_dept30

--Create a complex view

Create view vw_emp_dept

as

select e.*,d.did as deptid,d.dnm from emp e

INNER JOIN Dept d on e.did=d.did

--Calling the above view

select * from vw_emp_dept

#506-B, Nilgiri Block, Aditya Enclave, Ameerpet, Hyd. Ph: 040 66638869/ 9573168449
POWER BI ALL DATA FEEDS PRACTICE [VIDEO ASSISTANCE REQUIRED] 20

/*

Function

a) Perform set of operations and return result

b) It takes input parameters and return a result

c) Function contains set of statements and executed like a batch component

d) This is medium level component inside database to perform set of

operations

e) We have system defined functions [Ex: Upper, Lower, Trim etc..] and user

defined functions

*/

Syn:

Create function <function name> (arguments)

returns <type /value>


(
body
return ...
)

Example: Returning rows based on did passing

create function fn_dept (@did integer)

returns table

return select * from emp where did=@did;

--Calling to get dept 10 data

select * from fn_dept(10)

--Calling to get dept 20 data

select * from fn_dept(20)

#506-B, Nilgiri Block, Aditya Enclave, Ameerpet, Hyd. Ph: 040 66638869/ 9573168449
POWER BI ALL DATA FEEDS PRACTICE [VIDEO ASSISTANCE REQUIRED] 21

/* Procedure

a) Complex object inside database to perform set of operations

b) It is precompiled collection of statements to execute the operations

[when you create procedure, system compiles and stores compiled body.

we call, the compiled body executes the code instead of doing

re-compilation]

c) It takes input parameters, pass output parameters, and also return

result [optional]

d) Procedure support exception handling, many statements, temporary tables


etc...

*/
Syn:

Create procedure <prname(args)--May be input type / output type

as

Begin

Body

Return --optional

End;

Ex:
--Create a simple procedure to get all rows from emp table

create procedure pr

as

Begin

select * from emp;

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

--Create a simple procedure and pass input parameters

create procedure pr1(@did integer)

as

Begin

select * from emp where did=@did;

End;

--calling a procedure to get dept 10 data

Execute pr1 10

--Create a simple procedure and pass input parameters and get output

parameter

create procedure pr2(@did integer,@dnm varchar(30) out)

as

Begin

select @dnm=dnm from dept where did=@did;

End;

--calling a procedure to get dept 10 data

Declare @dname varchar(30) --intermediate variable creation

Execute pr2 20, @dname out

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

parameter and return values

create procedure pr3(@did integer,@dnm varchar(30) out)

as

Begin

Declare @cnt integer;

select @cnt=count(*) from emp;

select @dnm=dnm from dept where did=@did;

return @cnt;

End;

--calling a procedure to get dept 10 data

Declare @dname varchar(30),@count integer --intermediate variable creation

Execute @count=pr3 20, @dname out

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

what to focus on SQL

#506-B, Nilgiri Block, Aditya Enclave, Ameerpet, Hyd. Ph: 040 66638869/ 9573168449
POWER BI ALL DATA FEEDS PRACTICE [VIDEO ASSISTANCE REQUIRED] 24

Q: How many ways we get data from a database?

SQL CONSTRUCTS [a) SELECT b)VIEWS c)PROCEDURES d)FUNCTIONS]

SELECT STATEMENT

Che-View [Single select]

Vskp-View [Single select]

Hyd-View [Single select]

Tables
[Data-All
Locations ]
Operations [Permanent /
Temporary] Procedure [many statements]
Result [optional]

Operations [Permanent /
Temporary] Functions [many statements]
Return result [compulsory]

DIRECT SELECT VIEW PROCEDURE FUNCTION


Hits database Logical object Multiple operations Multiple operations
tables and get performing and
Which calls underlying {few operations}
data returning result
select and hit tables

Return result Return result Result is optional Result compulsory


One statement One statement (select) Multiple statements Multiple statements

#506-B, Nilgiri Block, Aditya Enclave, Ameerpet, Hyd. Ph: 040 66638869/ 9573168449
POWER BI ALL DATA FEEDS PRACTICE [VIDEO ASSISTANCE REQUIRED] 25

How many ways we get data In Power BI?

a)Import mode (choose tables or views / write query / call procedure)

b)Direct Query (choose tables or views / write query / call procedure)

Get the SQL Server Details:

Instance Name, Database name, Object Name / View / Procedure


Get Data--> SQL Server-->
Instance Name: DESKTOP-RN4SMHT\VINAYTECH_2017
Database Name: VINAYTECH_DEV_Business_Details

Import

Choose the tables to Load / Edit

Database Views:

a) Logical object / window to tables / virtual object

b) No data inside view, it has just one Select Statement Structure

c) When we call view (using simple select), it hits the database and execute the select statement
inside body and retrieves data.

Create like below in SSMS--> Vinaytech_Business_Details database

#506-B, Nilgiri Block, Aditya Enclave, Ameerpet, Hyd. Ph: 040 66638869/ 9573168449
POWER BI ALL DATA FEEDS PRACTICE [VIDEO ASSISTANCE REQUIRED] 26

CREATE VIEW VW_Business_Details AS


(
SELECT DC.*, DM.*, F.Actual_fee, F.Discount_Fee
FROM FactPayments F
INNER JOIN DimCourse DC ON DC.CourseID=F.CourseID
INNER JOIN DimCourseMode DM ON DM.ModeID=F.ModeID
)

Calling:

SELECT * FROM VW_Business_Details

Scenario: Getting data from SQL Server Database and Generate Report from Views.

There are two ways

a) Import / direct query, choose view from the list


b) Import / Direct query, write a select statement to get data

b) Second way:

Get the SQL Server Details:


Instance Name, Database name, Object Name / View / Procedure
Get Data--> SQL Server-->
Instance Name:DESKTOP-RN4SMHT\VINAYTECH_2017
Database Name: VINAYTECH_Business_Details
Direct Query
Advanced tab
Command timeout in minutes: 30 (After 30 minutes query execution aborted)
SQLStatement:

#506-B, Nilgiri Block, Aditya Enclave, Ameerpet, Hyd. Ph: 040 66638869/ 9573168449
POWER BI ALL DATA FEEDS PRACTICE [VIDEO ASSISTANCE REQUIRED] 27

Select * from VW_BUSINESS_DETAILS

Database Procedures

a) Precompiled object with collection of statements, so at run time it will not compile and
directly participate in execution.

b) Procedures can implement multiple statements and perform an operation.

c) Procedures are recommended to make database changes isolated (independent) to the


Power Bi Report.

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

Create a procedure like below in SSMS

CREATE PROCEDURE PR_BUSINESS_DETAILS(@ Year as integer)


AS
BEGIN
SELECT
DC.COURSENAME, DC.DURATION,
DM.DESCRIPTION,
DI.INSTITUTENAME,
DL.LOCATIONNAME,
DS.STUDENTID, DS.FST_NAME, DS.CITY, DS.STATE_NAME, DS.COUNTRY_REGION,
DT.DATE, DT.YEAR, DT.QUARTER, DT.MONTH, DT.MONTHNAME, DT.DAY,
F.ACTUAL_FEE,F.DISCOUNT_FEE,F.[Tax amount]
FROM FactPayments F
INNER JOIN DimInstitute AS DI
ON F.INSTITUTEID=DI.INSTITUTEID
INNER JOIN DIMCOURSE AS DC
ON F.CourseID=DC.CourseID
INNER JOIN DimCourseMode AS DM
ON F.ModeID=DM.ModeID
INNER JOIN DimLocation AS DL
ON F.LocationID=DL.LocID
INNER JOIN DimStudent AS DS
ON F.StudentID=DS.StudentID
INNER JOIN DimDate AS DT
ON F.Date=DT.Date
Where DT.Year=@Year
END;

#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.

Get the SQL Server Details:


Instance Name, Database name, Object Name / View / Procedure
Get Data--> SQL Server-->
Instance Name: DESKTOP-RN4SMHT\VINAYTECH_2017
Database Name: VINAYTECH_Business_Details

Import

Advanced tab
Command timeout in minutes: 30 (After 30 minutes query execution aborted)

SQL Statement: PR_BUSINESS_DETAILS 2019

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

SCENARIO: Practice Modes [Import, Direct Query and Connect Live]

a) Import: [Two ways]

Get data->SQL Server-> Import-> choose tables-> Load

1st Way:

Get data->SQL Server-> Import-> choose tables-> Load

2nd Way:

Get data->SQL Server->Import -> go to advanced specify timeout and write query-> Load

b) Direct Query: [Two ways]

1st Way:

Get data->SQL Server-> Direct Query-> choose tables-> Load

2nd Way:

Get data->SQL Server-> Direct Query-> go to advanced specify timeout and write query->
Load

c) Connect Live: [Two ways] For Analysis Services Only

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?

Identify Multidimensional or Tabular cube

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

Why Tabular Model and Power BI combination is good?

Tabular Model Power BI


Supports modeling When you use in Power BI, no need to model
Supports Calculations, measures You can use those directly instead of creating here
creation using DAX
Uses in memory process (vertipaq) Uses in memory process (vertipaq)

What is mode in Power BI?

The way you keep content in Power BI Desktop.

Scenario: Get data through Python Script

Refer to Python script and visual topic in this material

#506-B, Nilgiri Block, Aditya Enclave, Ameerpet, Hyd. Ph: 040 66638869/ 9573168449
POWER BI ALL DATA FEEDS PRACTICE [VIDEO ASSISTANCE REQUIRED] 33

Scenario: Get data from Azure SQL Database [cloud]

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

Scenario: Create table / Query dynamically

Go to Power Query Editor→ Click Enter Data→ Enter like below

#506-B, Nilgiri Block, Aditya Enclave, Ameerpet, Hyd. Ph: 040 66638869/ 9573168449
POWER BI ALL DATA FEEDS PRACTICE [VIDEO ASSISTANCE REQUIRED] 35

Differences between Load, Import, Direct Query and Connect Live

Load Import Direct Query Connect Live


Structure and Data and structure comes to Structure comes from Structure comes from
Data Power BI Desktop (in-memory) databases Analysis Services

Data limitation [1GB] NA NA


Data refresh required [manual or Not required [always hit] Not required [always
scheduled [either 8 / 48] hit]
Files More sources [excel, file etc…] Databases Analysis Services
databases
Report view, Report View, Data View, and Report View and Model Mostly Report View
Data view, Model View available View [As SSAS has in built
Model view [No Data view] model]
available
Refresh Report queries your Power BI Report Queries your Report queries your
required dataset actual data source actual data source
Import for SSAS tabular model Direct query for SSAS Connective live
possible tabular not possible possible
Over medium sized datasets Over large datasets to
with pre-aggregations show current data
Single and both directions Mostly the relationship is
possible single direction [both
direction has limitation]
Full support to Time Intelligence Time intelligence
capabilities. It treats date table capabilities not available.
columns as date columns It will treat date table
columns as normal.
Full Full modeling and Limited modeling and
transformations transformations
1 GB data 1GB data limit applied Number of rows it can
return is 1 million [it can
work with more than 1
million for aggregates]

#506-B, Nilgiri Block, Aditya Enclave, Ameerpet, Hyd. Ph: 040 66638869/ 9573168449
POWER BI ALL DATA FEEDS PRACTICE [VIDEO ASSISTANCE REQUIRED] 36

[Basic Practical Document with multiple Data Feeds]

Get Data, Transform Data, Model Data, Report Data, Publish,


Dashboard Create, Alerts to Dashboard, Subscription and
End to End report process Sharing to Reports and Dashboards, Working on Customer
in Power BI Reviews.

Flat file load practice Get Data--> Files-->Text / .csv file

Use Sample.xlsx to
generate report Get Data--> Files--> Excel

Use Budget.xlsx to
generate report Get Data--> Files--> Excel

Working with SQL Server Get Data--> SQL Server Database

SQL Server Import Mode Get Data--> SQL Server Database, choose Import Mode

SQL Server Database Direct


Query Mode Get Data--> SQL Server Database, choose Direct Query Mode

SQL Server Database


Customized query retrieval Get Data--> SQL Server Database, Import Mode / Direct Query

SQL Server Database View


Data Get Data--> SQL Server Database, Import Mode / Direct Query

SQL Server Database Get Data--> SQL Server Database, Import / Direct Query, but
Procedure Data Advanced option and SQL Command area is required

SQL Server Database View


Data

Working with SQL Server


Analysis Services

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 Web

Getting Data from JSON Get Data--> Files-->JSON a) Read like List b) Convert to
File table c) Expand columns to show like table

View Menu--> Browse theme--> Specify JSON file [


Import Theme Vinaytech_Business_Details.JSON]

Getting Data from Blank Get Data--> Blank Query--> Expression Bar
Query [=List.Numbers(2000,25)]

Get Data--> Blank Query--> Go to Advanced Editor and write the


Getting Data Through mash up statements [ from material copy and paste]
Mashup Process Refer to Power Query Material PDF-5

Getting Data Through


Python Script Get Data--> Python Script

Getting Data from Azure Know the SQL Server name(vinaytech.database.windows.net),


SQL Database / Data Database Name, Credentials to connect to that, and Firewall
warehouse Settings.

FREQUENTLY ASKED QUESTIONS IN THIS TOPIC

How to change from Direct


Query to Import Mode? Simply go to Power BI Dataset status bar and click Switch mode.

How to change from


Import Mode to Direct Lot of process involved to do this. [Refer to the document
Query? given]

Difference between Query Query contain multiple columns, whereas List contain single
and List? column.

Having Import and Direct Query in a storage mode level is called


What is Mixed Mode? Mixed Mode.

How do we identity which


mode you are in? Go to Desktop→ Report View→ Status bar [right corner]

Which mode we can covert


from Mixed Mode? Import Mode

#506-B, Nilgiri Block, Aditya Enclave, Ameerpet, Hyd. Ph: 040 66638869/ 9573168449
POWER BI ALL DATA FEEDS PRACTICE [VIDEO ASSISTANCE REQUIRED] 38

Changing mode from Direct Query to Import

Down status bar in the dataset, mode change is visible, you can do.

Can we maintain dual mode (import and direct query)

Yes, possible.

How do we select all queries?

Go to edit queries, left hand side, hold top query, hold shift query and click on the

bottom query, ctrl+c

and Ctrl+V in the note pad

Converting from import to live connection?

1) Edit query, select all, delete all queries

Close and apply

2) Get data, analysis services and live connection

Which mode is recommended in Real-time?

For less volumes of data, Import / Load mode is required

For more volumes of data, Direct Query / Connect Live is recommended.

#506-B, Nilgiri Block, Aditya Enclave, Ameerpet, Hyd. Ph: 040 66638869/ 9573168449
POWER BI ALL DATA FEEDS PRACTICE [VIDEO ASSISTANCE REQUIRED] 39

What happens in case of Import Mode?

a)Data comes from sources to Power BI Desktop

b) This Desktop occupies memory, so we call this as “in-memory”

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

You might also like