Power BI Workshop
Power BI Workshop
Date :- 24-11-2024
2) Fact Table :- In the fact table we store data related to any transaction or event /
or facts and figures. For example :- in banking system one entity is customer 2 nd
entity is banking 3rd record is transaction table in that you have transaction id , what
type of transaction, how much was debited, what is the balance etc. These types of
data are stored in the fact table. In the fact table you have both the keys. Primary
key will only come one time and foreign key will come multiple time.
Make power pivot for many things like 2-3 things from each file
You have to go to power pivot and then manage , here you are going to make your
data ready, on excel we shall create reports but in power pivot manage in
following :-
1) Go home Get external data From other sources excel file please press
use first row as column headers (it is important to tick the check box) . Making this
is like green room for data you first do your work in power pivot.
2) The file opened is not excel but a data model, entire section is divided into 2
parts, above is -------, below section is calculation section
3) On home tab extreme right corner Diagram view Make relationship (1 too
many and many too one relationship).
4) Make one too many relationships with cookie type and product. Try to create the
relationship of one too many in power bi and power pivot.
5) Go to data view. Our requirement is like to create total revenue, ii) Profit, iii) Profit
Margin, iv) Total revenue by country, v) Total quantity by customer, vi) Total margin
by product. These are the different reports we want to create from Cookie crunch
data. Here we can use
6) First created a new column for revenue in Orders, Use orders * related function
and your values will be calculated here. This type of formula what we are using is
called DAX function. Till now everything is happening in data model and nothing in
the main excel sheet.
7) The single final answer of all the values from the columns is called measure. Total
revenue and profit is calculated by formula – Total revenue:= sum(the formula) and
enter. This is done is working column of the Power pivot.
8) To go to excel (switch to excel) just go to top left corner and press the dark excel
sheet. Then insert pivot table from data model (use data from data model and
create a pivot table in A1 cell). A blank layout with 3 tables appears.
Power BI Process:-
when we extract data from SQL server (where lots of data in form of tables is made)
we perform ETL Process 1) Extract the data , 2 ) Cleaning (transformation)
process , 3) Loading - Data warehouse (mini server) where after cleaning and all we
dump our report.
Only in Power BI desktop you can pull data, Model data, clean data only in the
desktop version not in cloud.
Very first work for data analysis is :- 1) Data preparation, there are different tables
are available in different platforms (like text file, excel, word file, SQL server etc).
keep in mind the requirement list, which will be different and yours will be different,
this is completely based on the requirement list of the client.
Process :- Original data Power BI desktop Clean your data Model your data
Visualise your data And report your data.
In power BI if you want to create a relationship yourself and take help from power BI
you can uncheck 2 boxes, from the options tab.
When taking a data from direct query mode in power BI desktop it will not show, it
will only show in Power BI transform Data.
* If you have dynamic tables every 5 mins update then go for uploading direct query
mode from SQL server, and if your data is static and not being updated every 5
mins go for imported mode (also upto 1 GB).
* When using import mode it is flexible you can make relationships and make
transformations, but if you are using direct query data is only available on server
which is a relational database, there you cannot disrupt the database.
* Any direct query table when connected with import table it will always be dual
connection.
* When taking data direct from folder, make sure that sequence of
columns are same before loading the data.
* MongoDB, Assure Cosmos DB. Are databases from NoSQL databases. (here
data is not available in rows and columns.) This database will be used in social
media, since it does not have structured database.
Here The data is unstructured (NoSQL) , if NoSQL you don’t know the data engineer
will give you file in JSON file. Here go to Azzure DB and get file and take data and
load it.
* 3rd party application and you can paste url and paste it in the get data More
Online services select it, put path of application and load data.
* If you want to take data from lets say money control or something you copy url
got to get data Other Web Enter the URL and power BI will go and check.
(you can get data from websites)
* Fix refresh problems by, Transform data Tools Diagnose Step Refresh
Stop diagnostics
* The language which is used in power query editor where you remove columns and
so many other things and then send to advanced editor, that is called M language.
STAGE II
* You have to do pivot data to unpivot. i.e sometimes we have structured data we
have to unstructured it, i.e columns to rows and rows are changed to columns.
* When unpivoting the data the two columns added to the data set are values and
attributes.
Transform data View and click on column quality , here it is showing % of valid
data, errors and empty column.
When combining tables with rows by adding rows its called as appending
Left outer means :- All the record from table one and the matching record from table
two (merger)
Right outer means : when merge column will have the records which have values
and the remaining will be ignored
Data Modeling:
One of the important and most tedious task for a Data analyst. By doing this well we
will be able to make accurate reports, faster exploration, simple aggregations and it
will be easier to maintain.
Always follow Star Schemas i.e structure of the data model.
Fact table should come in middle and all dimensions table should be around it
Cross filter : Allows data to flow both ways, where one filter will be put in both the
tables even when you do it in one table.
Hierarchy : Organize data such that one element is ranged over other data.
A dimension that can filter related facts differently. Example 3 tables inside
date table,, ship date ,due date and order date,, one date table can alternate that
fact table as it has 3 relations. But only one relationship can be active at a time.
Date 05-01-2025
Microsoft has made language (code) like in excel we do sum or if or some other
formulas, in Power BI it is called DAX. Go to Dax guide in google to find all the
functions and what are its formulas.
Difference in calculate Column and measure :- in power BI when you do sum of all
values or calculate the sum total of a range, and the answer in one particular cell is
given, that calculation is called a measure. Basically it’s a summarization of data in
a single cell. Measure is stored in RAM and not in the file you are working on.
Measures are always created in Facts table.
To create measures :- Click on enter data Click on name table And simply press
load, a blank table is created, now this is the table where we are going to store all
measures.
In facts internt sales table we want to total sales amount, now we want to add it, so
we will create a measure, right click on all measures Click new measure there
automatically measure = will come so there we rename it to Total sales= (formula
bars comes with a default name you rename it) you press sum and then sales
amount press tab and close the table with bracket and press enter.
The result of measure is not seen on table view but only can be seen in the visual,
We have to take some visual and put it in the sheet then only measure result can be
seen. If measure has to be seen you press card then click on total sales amount
in visual you can see the amount i.e the answer of measure.
Columns vs. measures :- CC (calculate columns) creates new value for each and
every row in the column 2) CC is stored in power BI PBX. file only i.e it will increase
fill size ,
Measures :- Created on demand, measures are calculated based on filters so it will
change according to the filters, if we apply filter answer will change and if we
unfilter it will change
Context two types :- 1) filter context and 2) Row context (which is equivalent to your
calculate column).
Use relationship function helps in not going to physically making relations made
active or inactive, you can directly make measures with inactive relationships also.
There is a concept of semi-additive measure creation also in power BI
Semi additive means total karna hai but not full. (not full addition). (example you
want last date total only of sales and not the other days total). To create semi
additive function you have 2 functions one is first date and last date function can be
used to create semi additive measures.
Time intelligence :- This time last year, and many more functions.
A good practice of creating a power BI report is go with the theme, like company
theme etc.