0% found this document useful (0 votes)
47 views95 pages

Power Bi

Uploaded by

varunvvc4
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)
47 views95 pages

Power Bi

Uploaded by

varunvvc4
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/ 95

Experiment Number: 01

Aim:
Installation and overview in power BI Desktop.

Procedure:
➢ Users can select a language in which they want to install Power BI and following files are
available for download.

➢ This is the link to directly download Power BI files –


➢ https://www.microsoft.com/en-us/download/details.aspx?id=45331

1|VVIT Dept of CSE


➢ PBIDesktop_x64.msi shows a 64-bit OS file. Select the file you want to install as per OS
type and click Next. Save the installation file on the local drive.

➢ When you run the installation file, following screen is displayed.

➢ Click on Next to continue the process of installing the software.

2|VVIT Dept of CSE


➢ Accept the License agreement and click on Next.

➢ Check the box for creating the desktop shortcut for easy access and then click install.

3|VVIT Dept of CSE


➢ Click on Yes to allow app to change in your device and choose the path where to install.

➢ Follow the status bar until the installation.

4|VVIT Dept of CSE


➢ When Power BI is installed, it launches a welcome screen. This screen is used to launch
different options related to get data, enrich the existing data models, create reports as well
as publish and share reports.

5|VVIT Dept of CSE


6|VVIT Dept of CSE
Experiment Number: 02

Aim:
Import the data from different sources such as (Excel, SqlServer, Oracle etc.) and load in
the target system.

Procedure:

1. Importing the Dataset:


➢ Launch Power BI Desktop.
➢ Click on "Get Data" in the Home tab of the ribbon.
➢ Select the appropriate data source option "Excel” and follow the prompts to import your
sample dataset into Power BI.

2. Insert Rectangle Shape:

➢ Click on “Format tab” on right side and perform changes on visual.


➢ Shape > Style > #E66C37
➢ Shape > Text >Text = “Sales report” , Font Size = 46, Horizontal Alignment = “Center”.

Output:

7|VVIT Dept of CSE


3. Add Card with Current Date:
➢ With the card visualization selected, locate the "Fields" pane on the right-hand side.
➢ Right-click anywhere in the "Fields" pane and select "New Measure" from the context
menu. This will open the formula bar at the top.
➢ In the formula bar, enter the following DAX formula to create a measure that calculates
the current date:
CurrentDate = Now()
➢ Press Enter to apply the formula.
➢ Visualization >Format Visual > General > Effects > Background Color : #E6E6E6
➢ Visualization > Format Visual >Visual > Category Label > Font Size = 12

Output:

4. Create Stacked Bar Chart:


➢ Visualizations >Build Visuals >Fields > Y –Axis =”Category”
➢ Visualizations >Build Visuals >Fields > X-Axis =”Sales”
➢ Visualizations >Format Visuals> Y-axis> Values >Color = #6B2328
➢ Visualizations >Format Visuals> Y-axis> Values >Title >Color = #E66C37
➢ Visualizations >Format Visuals> Y-axis> Values >Color = #6B2328
➢ Visualizations >Format Visuals> Y-axis> Values >Title >Color = #E66C37
➢ Visualizations >Format Visuals> Bar> Show All
➢ Visualizations >Format Visuals> Bar> Technology > Color = #A1343C
➢ Visualizations >Format Visuals> Bar> Furniture > Color = #6D5A00
➢ Visualizations >Format Visuals> Bar> Office Supplies> Color = #09124F
➢ Visualizations >Format Visuals> Data Labels > Options> Inside Center
➢ Visualizations >Format Visuals> Data Labels> Values > Font Size = 18
➢ Visualizations >Format Visuals> Title> Text =”Sale by Category”
➢ Visualizations >Format Visuals> Title> Font Size =25
➢ Visualizations >Format Visuals> Effects> Background Color = #E6E6E6

8|VVIT Dept of CSE


Output:

5. Create a Card to display Sum of Sales:


➢ With the card visualization selected, locate the "Fields" pane on the right-hand side.
➢ Drag “Sales” to “Fields”.
➢ Visualization >Format Visual > General > Effects > Background Color : #E6E6E6
➢ Visualization > Format Visual >Visual > Category Label > Font Size = 24

Output:

6. Create a Card to display Total Orders:


➢ With the card visualization selected, locate the "Fields" pane on the right-hand side.
➢ Drag “OrderID” to “Fields” and change it to count orders.
➢ Visualization >Format Visual > General > Effects > Background Color : #E6E6E6
➢ Visualization > Format Visual >Visual > Category Label > Font Size = 24

Output:

9|VVIT Dept of CSE


7. Create a Card to display Total Orders:
➢ With the card visualization selected, locate the "Fields" pane on the right-hand side.
➢ Drag “Profit” to “Fields”.
➢ Visualization >Format Visual > General > Effects > Background Color : #E6E6E6
➢ Visualization > Format Visual >Visual > Category Label > Font Size = 24

Output:

8. Create Donut Chart:


➢ Drag “Regions” to Legend , “Sum of Sales” to Values.
➢ Visualizations > Build Visual > Legend > option =”Bottom Center”
➢ Visualizations > Build Visual > Legend > Text>Font =12
➢ Visualizations > Build Visual > Detail Labels >Position =”Center”
➢ Visualization >Format Visual > General > Effects > Background Color : #E6E6E6
➢ Visualizations >Format Visuals> Data Labels> Values > Font Size = 14

Output:

9. Create a Line Chart:


➢ Visualizations > Build Visual > X-axis =”Order Date” by Year, Quarter
➢ Visualizations > Build Visual > Y-axis =”Sum of Sales”
➢ Visualizations > Format Visual > Visual > X-axis > Color = #0D6ABF

10 | V V I T D e p t o f C S E
➢ Visualizations > Format Visual > Visual > Y-axis > Color = #0D6ABF
➢ Visualizations > Format Visual > General > Title > Text > Font > 20
➢ Visualization >Format Visual > General > Effects > Background Color : #E6E6E6
Output:

10. Final Visual Format:


➢ Visualizations > Page Information > Name =”Sales report”
➢ Visualizations > Canvas Background > color = #12239E
➢ Visualizations > WallPaper > Color = #A0D1FF

11 | V V I T D e p t o f C S E
Output:

12 | V V I T D e p t o f C S E
Experiment Number: 03

Aim:
Perform the Extraction Transformation and Loading (ETL) on Data and build Relationship
between Tables.

Procedure:

1. Importing the Dataset:


➢ Launch Power BI Desktop.
➢ Click on "Get Data" in the Home tab of the ribbon.
➢ Select the appropriate data source option "Excel” and follow the prompts to import
yoursample dataset into Power BI.

2. Transform the Data:

➢ Home > queries > Transform Data

Output:

13 | V V I T D e p t o f C S E
3. Use First Row as Headers:
➢ Select the First row of the table.
➢ Home > Transform > Use First Row as Headers.

Output:

4. Replace Values:
➢ Select one of the column from table in which we replace values.
➢ Home > Transform > Replace Values
➢ Replace the values by giving Existed value and the new text that need to get replaced in
the Value to Find and Replace with textboxes.

14 | V V I T D e p t o f C S E
Output:

5. Manage Columns:
➢ Home > Manage Columns > Choose Columns > Select the checkboxes of required
columns
➢ Home > Manage Columns > Go to column > Select the req Column checkbox to go that
column

Output:

15 | V V I T D e p t o f C S E
6. Reduce Rows:
➢ Home > Keep Rows > keep top rows > Specify num of rows(Fig1)
➢ Similarly, keep bottom rows, keep range of rows are done
➢ Home > Remove Rows > Remove bottom rows > specify num of rows to be removed
from bottom(Fig2)
➢ Similarly, Remove top rows, remove alternate rows can be done.

Output:

7. Split Column:

16 | V V I T D e p t o f C S E
Output:
➢ Split Column By Delimiter

➢ Split Column By Number of Characters

➢ Split Column By Positions

➢ Similarly, Split Column By Uppercase to Lowercase, Split Column By Lowercase to


Uppercase, Split Column By Digit to non-digit, Split column by non-digit to digit can be
done.

17 | V V I T D e p t o f C S E
8. Sort:
➢ Home > Sort > Sort Descending (Sort Highest to Lowest)

If we want to sort from lowest to highest then select Sort Ascending.

Output:

9. Group By:
➢ Home > Group By > Specify the column to Group By > Give the new column name and
Operation to get the desired output.

Output:

10. Create table:


➢ Home > Enter data > Create table by giving values to the columns

18 | V V I T D e p t o f C S E
Output:

11. Merge Queries:


➢ Home > Merge Queries >Select a table and matching columns to create a merging table

Output:

19 | V V I T D e p t o f C S E
12. Replacing Null values By Fill down or Fill up:
➢ Select a Column > Right Click > Select Fill option > Select Down

Output:

13. Append Queries:


➢ Home > Append Queries > Select table to append
➢ Concatenate rows from two tables into a single table.

20 | V V I T D e p t o f C S E
Output:

14. Data source Settings:


➢ Home > Data Source Settings > Change the path or loc of data (if needed).

➢ Open the power Bi desktop and Apply changes

21 | V V I T D e p t o f C S E
Output:

15. Relationships between tables:


➢ Select Model View at left vertical tab.
➢ Create table relations with correlations with them.
Output:

22 | V V I T D e p t o f C S E
23 | V V I T D e p t o f C S E
24 | V V I T D e p t o f C S E
Experiment Number: 04

Aim:
Create different Advanced visualization in a report.

Procedure:

1. Importing the Dataset:


➢ Launch Power BI Desktop.
➢ Click on "Get Data" in the Home tab of the ribbon.
➢ Select the appropriate data source option "Excel” and follow the prompts to import your
sample dataset into Power BI.

2. Importing Advance Visuals:


➢ To install them, first log in to the application
➢ Visualization > get more visuals > search for visuals > Click on ADD
➢ Add all mentioned visuals to the application i.e., Animated Bar Chart, Drill Down Donut
Pro, Play Axis, WordCloud, SunBurst, Scroller

25 | V V I T D e p t o f C S E
3. Creating Animated Bar Chart:
➢ Visualizations > Build Visual > Animated Bar Chart
➢ Visualizations > Build Visual > Name =”Sub Category”
➢ Visualizations > Build Visual > Value = “Sum of Sales”
➢ Visualizations > Build Visual > Period = “Order Date – Year”

Outputs per Year:

26 | V V I T D e p t o f C S E
3. Creating Animated Bar Chart:
➢ Visualizations > Build Visual > Drill Down Donut Pro
➢ Visualizations > Build Visual > Category = “Category Hierarchy”
➢ Visualizations > Build Visual > Value = “Profit”
➢ Click on center to reverse to drill up and click on one part side to drill down.

Output:

27 | V V I T D e p t o f C S E
28 | V V I T D e p t o f C S E
4. Creating Word Cloud:
➢ Visualizations > Build Visual > WordCloud
➢ Visualizations > Build Visual > Category = “State / Province”
➢ Visualizations > Build Visual > Value = “Sum of Profits”

29 | V V I T D e p t o f C S E
➢ Click on Name of state to view it values.
Output:

30 | V V I T D e p t o f C S E
5. Creating Play Axis:
➢ Visualizations > Build Visual > Play Axis
➢ Visualizations > Build Visual > Field= “Order Date”
Output:

6. Creating Sun Burst:


➢ Visualizations > Build Visual > Sun Burst
➢ Visualizations > Build Visual > Groups= “Category, Sub Category”
➢ Visualizations > Build Visual > Values = “sum of sales”
➢ Drill down by selecting category name on the chart and drill up by click on it again.

Output:

31 | V V I T D e p t o f C S E
6. Creating Scroller:
➢ Visualizations > Build Visual > Scroller
➢ Visualizations > Build Visual > Category= “City”
➢ Visualizations > Build Visual > Measure = “sum of sales”
➢ Visualizations > Build Visual > Category= “City”
➢ Visualizations > Build Visual > Measure = “Sum of profits”

Output:

32 | V V I T D e p t o f C S E
7. Final Report output:

33 | V V I T D e p t o f C S E
34 | V V I T D e p t o f C S E
Experiment Number: 05

Aim:
Create Reports Using set Interactions between Visuals, Hierarchies and Drilldown, Drill
through into Power BI.

Procedure:

1. Importing the Dataset:


➢ Launch Power BI Desktop.
➢ Click on "Get Data" in the Home tab of the ribbon.
➢ Select the appropriate data source option "Excel” and follow the prompts to import your
sample dataset into Power BI.

2. Insert Rectangle Shape:

➢ Click on “Format tab” on right side and perform changes on visual.


➢ Shape > Style > #E66C37
➢ Shape > Text >Text = “Sales report” , Font Size = 46, Horizontal Alignment = “Center”.

Output:

35 | V V I T D e p t o f C S E
3. Create a Slicer:
➢ Visualizations > Build Visual > Slicer
➢ Visualizations > Build Visual > Field = “Location”
➢ Visualizations >Format Visuals> Title> Font Size =14
➢ Visualizations >Format Visuals> Effects> Background Color = #9B0065
➢ Visualizations >Format Visuals> Effects> Height= 79
➢ Visualizations >Format Visuals> Effects> Width = 582

Output:

4. Add Card with Current Date:


➢ With the card visualization selected, locate the "Fields" pane on the right-hand side.
➢ Right-click anywhere in the "Fields" pane and select "New Measure" from the
contextmenu. This will open the formula bar at the top.
➢ In the formula bar, enter the following DAX formula to create a measure that
calculatesthe current date:
▪ CurrentDate = Now()
➢ Press Enter to apply the formula.
➢ Visualization >Format Visual > General > Effects > Background Color : #F18F49
➢ Visualization > Format Visual >Visual > Category Label > Font Size = 12

Output:

36 | V V I T D e p t o f C S E
5. Create Stacked Bar Chart:
➢ Visualizations >Build Visuals >Fields > Y –Axis =”Category Name Hierarchy”
➢ Visualizations >Build Visuals >Fields > X-Axis =”Sum of Selling Price”
➢ Visualizations >Format Visuals> Y-axis> Values >Color = #5F6B6D
➢ Visualizations >Format Visuals> Y-axis> Values >Title >Color = #374649
➢ Visualizations >Format Visuals> X-axis> Values >Color = #5F6B6D
➢ Visualizations >Format Visuals> X-axis> Values >Title >Color = #374649
➢ Visualizations >Format Visuals> Bar> Show All
➢ Visualizations >Format Visuals> Bar> Accessories> Color = #374649
➢ Visualizations >Format Visuals> Bar>Formal>color = #D2B04C
➢ Visualizations >Format Visuals> Bar> SemiFormal> Color = #00ACFC
➢ Visualizations >Format Visuals> Bar> Casual Wear> Color = #C83D95
➢ Visualizations >Format Visuals> Data Labels > Options> Inside Center
➢ Visualizations >Format Visuals> Data Labels> Values > Font Size = 18
➢ Visualizations >Format Visuals> Title> Text =”Sum of selling Price By Category Name”
➢ Visualizations >Format Visuals> Title> Font Size =24
➢ Visualizations >Format Visuals> Effects> Background Color = #F1792

Output:

6. Create Stacked Column Chart:

➢ Visualizations >Build Visuals >Fields > Y –Axis =”selling price”


➢ Visualizations >Build Visuals >Fields > X-Axis =”Month”
➢ Visualizations >Format Visuals> Y-axis> Values >Color = #374649
➢ Visualizations >Format Visuals> Y-axis> Values >Title >Color = #5F6B6D

37 | V V I T D e p t o f C S E
➢ Visualizations >Format Visuals> X-axis> Values >Color = #374649
➢ Visualizations >Format Visuals> X-axis> Values >Title >Color = #5F6B6D
➢ Visualizations >Format Visuals> Bar> Show All
➢ Visualizations >Format Visuals> Data Labels > Options> Inside Center
➢ Visualizations >Format Visuals> Data Labels> Values > Font Size = 14
➢ Visualizations >Format Visuals> Title> Text =”total selling price by month”
➢ Visualizations >Format Visuals> Title> Font Size =20
➢ Visualizations >Format Visuals> Effects> Background Color = #5C2D91

Output:

7. Create a Card to display Selling Price:

➢ With the card visualization selected, locate the "Fields" pane on the right-hand side.
➢ Right-click anywhere in the "Fields" pane and select "New Measure" from the
contextmenu. This will open the formula bar at the top.
➢ In the formula bar, enter the following DAX formula to create a measure that
calculatesthe total selling price:
o total selling price = SUMX(Data,Data[Selling price]*Data[Item quantity])
➢ Drag “Total Selling Price” to “Fields”.
➢ Visualization >Format Visual > General > Effects > Background Color : #5B2D71
➢ Visualization > Format Visual >Visual > Category Label > Font Size = 20

Output:

8. Create a Card to display Total Item Count:

➢ With the card visualization selected, locate the "Fields" pane on the right-hand side.
➢ Right-click anywhere in the "Fields" pane and select "New Measure" from the

38 | V V I T D e p t o f C S E
contextmenu. This will open the formula bar at the top.
➢ Drag “Total Item Count” to “Fields”.
➢ In the formula bar, enter the following formula to create a measure that calculates
the total item count:
o total item count = countx(data,Data[Item quantity])
➢ Visualization >Format Visual > General > Effects > Background Color : #AF916D
➢ Visualization > Format Visual >Visual > Category Label > Font Size = 20

Output:

9. Create a Card to display Profit:

➢ With the card visualization selected, locate the "Fields" pane on the right-hand side.
➢ Right-click anywhere in the "Fields" pane and select "New Measure" from the
contextmenu. This will open the formula bar at the top.
➢ Drag “profit” to “Fields”.
➢ In the formula bar, enter the following formula to create a measure that calculates
the profit:
o profit = Data[total selling price]-[total cost price]
➢ Visualization >Format Visual > General > Effects > Background Color :#5C0001
➢ Visualization > Format Visual >Visual > Category Label > Font Size = 20

Output:

10. Create a Card to display Profit %:

➢ With the card visualization selected, locate the "Fields" pane on the right-hand side.
➢ Right-click anywhere in the "Fields" pane and select "New Measure" from the
contextmenu. This will open the formula bar at the top.
➢ Drag “profit %” to “Fields”.
➢ In the formula bar, enter the following formula to create a measure that calculates
the profit%:
o %Profit = (Data[profit]/Data[total cost price])*100
➢ Visualization >Format Visual > General > Effects > Background Color : #F8BCBD

39 | V V I T D e p t o f C S E
➢ Visualization > Format Visual >Visual > Category Label > Font Size = 20

Output:

11. Create Stacked Bar Chart:

➢ Visualizations >Build Visuals >Fields > Y –Axis =”Category Name”


➢ Visualizations >Build Visuals >Fields > X-Axis =”Profit”
➢ Visualizations >Format Visuals> Y-axis> Values >Color = #5F6B6D
➢ Visualizations >Format Visuals> Y-axis> Values >Title >Color = #374649
➢ Visualizations >Format Visuals> X-axis> Values >Color = #5F6B6D
➢ Visualizations >Format Visuals> X-axis> Values >Title >Color = #374649
➢ Visualizations >Format Visuals> Bar> Show All
➢ Visualizations >Format Visuals> Bar> Accessories> Color = # F18F49
➢ Visualizations >Format Visuals> Bar>Formal>color = # F18F49
➢ Visualizations >Format Visuals> Bar> SemiFormal> Color = # F18F49
➢ Visualizations >Format Visuals> Bar> Casual Wear> Color = # F18F49
➢ Visualizations >Format Visuals> Data Labels > Options> Inside Center
➢ Visualizations >Format Visuals> Data Labels> Values > Font Size = 18
➢ Visualizations >Format Visuals> Title> Text =”Profit By Category Name”
➢ Visualizations >Format Visuals> Title> Font Size =18
➢ Visualizations >Format Visuals> Effects> Background Color = #008cEEE

Output:

40 | V V I T D e p t o f C S E
12. Create Donut Chart:
➢ Visualizations >Build Visuals >Fields > Legend=”Location”
➢ Visualizations >Build Visuals >Fields > Values=”Sum of Item Count”
➢ Visualizations >Format Visuals> Legend> slices >Color =”374649”
➢ Visualizations >Format Visuals> Values >Color = #5F6B6D
➢ Visualizations >Format Visuals> Legend> slices>Chennai >Color = #1DD5EE
➢ Visualizations >Format Visuals> Legend> slices>Banglore >Color = #5C2D91
➢ Visualizations >Format Visuals> Legend> slices >Hyderabad>Color = #F18F49
➢ Visualizations >Format Visuals> Bar> Show All
➢ Visualizations >Format Visuals> Data Labels > Options> Inside Center
➢ Visualizations >Format Visuals> Data Labels> Values > Font Size = 14
➢ Visualizations >Format Visuals> Title> Text =”Sum of Item amount by Location”
➢ Visualizations >Format Visuals> Title> Font Size =18
➢ Visualizations >Format Visuals> Effects> Background Color = #EF008C

Output:

13. Create Pie-Chart:

➢ Visualizations >Build Visuals >Fields > Legend=”Ordertype Name”


➢ Visualizations >Build Visuals >Fields > Values=”Sum of Item quantity”
➢ Visualizations >Format Visuals> Legend> slices >Color = #374649
➢ Visualizations >Format Visuals> Values >Color = #374649
➢ Visualizations >Format Visuals> Legend> slices>on line>Color = #FE6D86
➢ Visualizations >Format Visuals> Legend> slices>On Shop >Color = #F18F49
➢ Visualizations >Format Visuals> Bar> Show All
➢ Visualizations >Format Visuals> Data Labels > Options> Inside Center

41 | V V I T D e p t o f C S E
➢ Visualizations >Format Visuals> Data Labels> Values > Font Size = 14
➢ Visualizations >Format Visuals> Title> Text =”Sum of Item quantiy by ordertype name”
➢ Visualizations >Format Visuals> Title> Font Size =16
➢ Visualizations >Format Visuals> Effects> Background Color = #FFD86C

Output:

14. Create a Filter to clear Button:


➢ Insert > Shapes > Select “Rectangle Shape”
➢ Visualizations > Format > Shape > Text > “ON” > Text = “Clear”
➢ Visualizations > Format > Shape > Action > “ON”
➢ Now make all visuals to initial state the follow next step
➢ View > BookMark > Add BookMark =”Clear”
➢ Visualizations > Format > Shape > Action > Select = “BookMark”
➢ Visualizations > Format> Shape > Action > BookMark =”Clear”

Output:

15. Creating Hierarchy for drill down and drill up operations:


➢ Data > Category Name > Create hierarchy
➢ Data > Item Name > Add to hierarchy

42 | V V I T D e p t o f C S E
➢ Place cursor on visual > Click “  “ to drill down
➢ Place cursor on visual > Click “  “ to drill next level of hierarachy
Output:

Initial:

After Drill Down:

Drill through:
➢ To set up drillthrough, create a target report page that has the visuals you want for the
type of entity that you're going to provide drillthrough for.
➢ Then, on that drillthrough target page, in the Build visual section of the Visualizations
pane, drag the field for which you want to enable drillthrough into the Drill through well.

43 | V V I T D e p t o f C S E
➢ Add drill-through field = “CategoryName”

Output:

16. Final Visual Format:

➢ Visualizations >Page Information > Name =”Page1”


➢ Visualizations >canvas Background > color=”D8D7BF ”
➢ Visualizations > Wall Paper > color = “#FFFFFF”

44 | V V I T D e p t o f C S E
Output:

45 | V V I T D e p t o f C S E
46 | V V I T D e p t o f C S E
Experiment Number: 06

Aim:

Create Reports using Aggregation functions calculate a value such as count, sum, average,
minimum or maximum for all rows in a column or table as defined by the expression.
Procedure:

1. Importing the Dataset:

➢ Launch Power BI Desktop.


➢ Click on "Get Data" in the Home tab of the ribbon.
➢ Select the appropriate data source option "Excel” and follow the prompts to import yoursample
dataset into Power BI.

2. Insert Rectangle Shape:

o Click on “Format tab” on right side and perform changes on visual.


o Shape > Style > #E66C37
o Shape > Text >Text = “Sales report” , Font Size = 46, Horizontal Alignment = “Center”.

47 | V V I T D e p t o f C S E
3. Add card for Displaying Sum Values of Profit and sales :

➢ With the card visualization selected, locate the "Fields" pane on the right-hand side.
➢ Right-click anywhere in the "Fields" pane and select "New Measure" from the contextmenu. This
will open the formula bar at the top.
In the formula bar, enter the following DAX formula to create a measure that calculatesthe total
profit and sales.
TotalProfit = CALCULATE(SUM(ORDERS[PROFIT]))
TotalSales = CALCULATE(sum(Orders[Sales]))
➢ Press Enter to apply the formula.
➢ Visualization >Format Visual > General > Effects > Background Color : #E6E6E6
➢ Visualization > Format Visual >Visual > Category Label > Font Size = 12
Output:

Similarly, calculate the individual years total profit by using the below formulas:
• 2020Profit = CALCULATE(SUM(ORDERS[PROFIT]),year(Orders[Order Date])=2020)
• 2020Profit = CALCULATE(SUM(ORDERS[PROFIT]),year(Orders[Order Date])=2020)
• 2020Profit = CALCULATE(SUM(ORDERS[PROFIT]),year(Orders[Order Date])=2020)
• 2020Profit = CALCULATE(SUM(ORDERS[PROFIT]),year(Orders[Order Date])=2020)
Similarly, calculate the individual years total sales by using the below formulas:
▪ 2020sales = calculate(sum(Orders[Sales]),year(Orders[Order Date])=2020)
▪ 2020sales = calculate(sum(Orders[Sales]),year(Orders[Order Date])=2020)
▪ 2020sales = calculate(sum(Orders[Sales]),year(Orders[Order Date])=2020)
▪ 2020sales = calculate(sum(Orders[Sales]),year(Orders[Order Date])=2020)

OUTPUT:

48 | V V I T D e p t o f C S E
4. Add card for Displaying Average Values of Profit and sales :

➢ With the card visualization selected, locate the "Fields" pane on the right-hand side.
➢ Right-click anywhere in the "Fields" pane and select "New Measure" from the contextmenu. This
will open the formula bar at the top.
➢ In the formula bar, enter the following DAX formula to create a measure that calculatesthe
avearge profit and sales
avgprofit = CALCULATE(AVERAGE(Orders[profit]))
avgsales = CALCULATE(AVERAGE(Orders[Sales]))
➢ Press Enter to apply the formula.
➢ Visualization >Format Visual > General > Effects > Background Color : #B6E6E6
➢ Visualization > Format Visual >Visual > Category Label > Font Size = 12

Output:

Similarly, calculate the individual years average profit by using the below formulas:
• 2020avgProfit = CALCULATE(AVERAGE(ORDERS[PROFIT]),year(Orders[Order Date])=2020)
• 2021avgProfit = CALCULATE(AVERAGE(ORDERS[PROFIT]),year(Orders[Order Date])=2021)
• 2022avgProfit = CALCULATE(AVERAGE(ORDERS[PROFIT]),year(Orders[Order Date])=2022)
• 2023avgProfit = CALCULATE(AVERAGE(ORDERS[PROFIT]),year(Orders[Order Date])=2023)

Similarly, calculate the individual years average sales by using the below formulas:
• 2020avgsales = CALCULATE(AVERAGE(Orders[Sales]),year(Orders[Order Date])=2020)
• 2021avgsales = CALCULATE(AVERAGE(Orders[Sales]),year(Orders[Order Date])=2021)
• 2022avgsales = CALCULATE(AVERAGE(Orders[Sales]),year(Orders[Order Date])=2022)
• 2023avgsales = CALCULATE(AVERAGE(Orders[Sales]),year(Orders[Order Date])=2023)

OUTPUT:

49 | V V I T D e p t o f C S E
5. Add card for Displaying count of items and orders:

➢ With the card visualization selected, locate the "Fields" pane on the right-hand side.
➢ Right-click anywhere in the "Fields" pane and select "New Measure" from the contextmenu. This
will open the formula bar at the top.
➢ In the formula bar, enter the following DAX formula to create a measure that calculatesthe no of
items and orders
totalItems = CALCULATE(sum(orders[quantity]))
TotalOrders = CALCULATE(COUNT(Orders[Order ID]))
Press Enter to apply the formula.
➢ Visualization >Format Visual > General > Effects > Background Color : #E6F2g6
➢ Visualization > Format Visual >Visual > Category Label > Font Size = 12

Similarly, calculate the individual years orders by using the below formulas:
• 2020OrderCount = CALCULATE(count(Orders[Order ID]),year(Orders[Order Date])=2020)
• 2021OrderCount = CALCULATE(count(Orders[Order ID]),year(Orders[Order Date])=2021)
• 2022OrderCount = CALCULATE(count(Orders[Order ID]),year(Orders[Order Date])=2022)
• 2023OrderCount = CALCULATE(count(Orders[Order ID]),year(Orders[Order Date])=2023)

Output:

Similarly, calculate the individual year items by using the below formulas:
• 2020items = calculate(sum(Orders[Quantity]),year(Orders[Order Date])=2020)
• 2021items = calculate(sum(Orders[Quantity]),year(Orders[Order Date])=2021)
• 2022items = calculate(sum(Orders[Quantity]),year(Orders[Order Date])=2022)
• 2023items = calculate(sum(Orders[Quantity]),year(Orders[Order Date])=2023)

Output:

50 | V V I T D e p t o f C S E
7. Add card for Displaying max and min no of orders:

➢ With the card visualization selected, locate the "Fields" pane on the right-hand side.
➢ Right-click anywhere in the "Fields" pane and select "New Measure" from the contextmenu. This
will open the formula bar at the top.
➢ In the formula bar, enter the following DAX formula to create a measure that calculatesthe max
and min no of orders
maxCount = CALCULATE(MAX(Orders[Order ID]))
minCount = CALCULATE(MIN(Orders[Order ID]))
Press Enter to apply the formula.
➢ Visualization >Format Visual > General > Effects > Background Color : #E6F2g6
Visualization > Format Visual >Visual > Category Label > Font Size = 14
OUTPUT:

Similarly, calculate the individual year max orders by using the below formulas
• 2020maxCount = CALCULATE(max(Orders[Order ID]),year(Orders[Order Date])=2020)
• 2021maxCount = CALCULATE(max(Orders[Order ID]),year(Orders[Order Date])=2021)
• 2022maxCount = CALCULATE(max(Orders[Order ID]),year(Orders[Order Date])=2022)
• 2023maxCount = CALCULATE(max(Orders[Order ID]),year(Orders[Order Date])=2023)

OUTPUT:

Similarly, calculate the individual year min orders by using the below formulas:

• 2020minCount = CALCULATE(min(Orders[Order ID]),year(Orders[Order Date])=2020)


• 2021minCount = CALCULATE(min(Orders[Order ID]),year(Orders[Order Date])=2021)
• 2022minCount = CALCULATE(min(Orders[Order ID]),year(Orders[Order Date])=2022)
• 2023minCount = CALCULATE(min(Orders[Order ID]),year(Orders[Order Date])=2023)

51 | V V I T D e p t o f C S E
OUTPUT:

8. Final Visual Format for profit page:


➢ Visualizations > Page Information > Name =”Profit”
➢ Visualizations > Canvas Background > color = #12239E
➢ Visualizations > WallPaper > Color = #A0D1FF

9. Final Visual Format for sales page:


➢ Visualizations > Page Information > Name =”Sales”
➢ Visualizations > Canvas Background > color = #12239E
➢ Visualizations > WallPaper > Color = #A0D1F

52 | V V I T D e p t o f C S E
Output:

53 | V V I T D e p t o f C S E
54
Experiment Number: 07

Aim:

Create reports using caluculations based on dates and times.


Procedure:

1. Importing the Dataset:

➢ Launch Power BI Desktop.


➢ Click on "Get Data" in the Home tab of the ribbon.
➢ Select the appropriate data source option "Excel” and follow the prompts to import your
sample dataset into Power BI.

2. Insert Rectangle Shape:

o Click on “Format tab” on right side and perform changes on visual.


o Shape > Style > #E66C37
o Shape > Text >Text = “Dates and Time” , Font Size = 46, Horizontal Alignment =
“Center”

55
3. Create Stacked Column Chart:

➢ Visualizations >Build Visuals >Fields > Y –Axis =”sum of profit”


➢ Visualizations >Build Visuals >Fields > X-Axis =”day”
➢ For day data field create a new column measure
➢ Orders->NewColumn->and enter the below dax formula:
Day = DAY(Orders[Order Date].[Date])
➢ Visualizations >Format Visuals> Y-axis> Values >Color = #374649
➢ Visualizations >Format Visuals> Y-axis> Values >Title >Color = #5
➢ Visualizations >Format Visuals> X-axis> Values >Color = #374649
➢ Visualizations >Format Visuals> X-axis> Values >Title >Color = #5F6B6D
➢ Visualizations >Format Visuals> Bar> Show All
➢ Visualizations >Format Visuals> Data Labels > Options> Inside Center
➢ Visualizations >Format Visuals> Data Labels> Values > Font Size = 14
➢ Visualizations >Format Visuals> Title> Text =”sum of profit by day”
➢ Visualizations >Format Visuals> Title> Font Size =20
➢ Visualizations >Format Visuals> Effects> Background Color = #5C2D91

4. Create Stacked Column Chart:


Visualizations >Build Visuals >Fields > Y –Axis =”sum of profit”
➢ Visualizations >Build Visuals >Fields > X-Axis =”month”
➢ For month data field create a new column measure
➢ Orders->NewColumn->and enter the below dax formula:
Month = MONTH(Orders[Order Date].[Date])
Visualizations >Format Visuals> Y-axis> Values >Color = #374649
➢ Visualizations >Format Visuals> Y-axis> Values >Title >Color = #5
➢ Visualizations >Format Visuals> X-axis> Values >Color = #374649
➢ Visualizations >Format Visuals> X-axis> Values >Title >Color = #5F6B6D

56
➢ Visualizations >Format Visuals> Bar> Show All
➢ Visualizations >Format Visuals> Data Labels > Options> Inside Center
➢ Visualizations >Format Visuals> Data Labels> Values > Font Size = 14
➢ Visualizations >Format Visuals> Title> Text =”sum of profit by month”
➢ Visualizations >Format Visuals> Title> Font Size =20
➢ Visualizations >Format Visuals> Effects> Background Color = #e6b999

5. Create Stacked Column Chart:

➢ Visualizations >Build Visuals >Fields > Y –Axis =”sum of profit”


➢ Visualizations >Build Visuals >Fields > X-Axis =”month name”
➢ For monthname data field create a new column measure
➢ Orders->NewColumn->and enter the below dax formula:
MonthName = Orders[Order Date].[Month]
Visualizations >Format Visuals> Y-axis> Values >Color = #374649
➢ Visualizations >Format Visuals> Y-axis> Values >Title >Color = #5
➢ Visualizations >Format Visuals> X-axis> Values >Color = #374649
➢ Visualizations >Format Visuals> X-axis> Values >Title >Color = #5F6B6D
➢ Visualizations >Format Visuals> Bar> Show All
➢ Visualizations >Format Visuals> Data Labels > Options> Inside Center
➢ Visualizations >Format Visuals> Data Labels> Values > Font Size = 14
➢ Visualizations >Format Visuals> Title> Text =”sum of profit by month name”
➢ Visualizations >Format Visuals> Title> Font Size =20
➢ Visualizations >Format Visuals> Effects> Background Color = #ebf89f

57
6. Create Stacked Column Chart:

➢ Visualizations >Build Visuals >Fields > Y –Axis =”sum of profit”


➢ Visualizations >Build Visuals >Fields > X-Axis =”quarter”
➢ For quarer data field create a new column measure
➢ Orders->NewColumn->and enter the below dax formula:
Quarter = QUARTER(Orders[Order Date].[Date])
➢ Visualizations >Format Visuals> Y-axis> Values >Color = #374649
➢ Visualizations >Format Visuals> Y-axis> Values >Title >Color = #5
➢ Visualizations >Format Visuals> X-axis> Values >Color = #374649
➢ Visualizations >Format Visuals> X-axis> Values >Title >Color = #5F6B6D
➢ Visualizations >Format Visuals> Bar> Show All
➢ Visualizations >Format Visuals> Data Labels > Options> Inside Center
➢ Visualizations >Format Visuals> Data Labels> Values > Font Size = 14
➢ Visualizations >Format Visuals> Title> Text =”sum of profit by quarter”
➢ Visualizations >Format Visuals> Title> Font Size =20
➢ Visualizations >Format Visuals> Effects> Background Color = #e8d166

58
7. Create Stacked Column Chart:
➢ Visualizations >Build Visuals >Fields > Y –Axis =”sum of profit”
➢ Visualizations >Build Visuals >Fields > X-Axis =”quarter name”
➢ For quartername data field create a new column measure
➢ Orders->NewColumn->and enter the below dax formula:
QuarterName = Orders[Order Date].[Quarter]
➢ Visualizations >Format Visuals> Y-axis> Values >Color = #374649
➢ Visualizations >Format Visuals> Y-axis> Values >Title >Color = #5
➢ Visualizations >Format Visuals> X-axis> Values >Color = #374649
➢ Visualizations >Format Visuals> X-axis> Values >Title >Color = #5F6B6D
➢ Visualizations >Format Visuals> Bar> Show All
➢ Visualizations >Format Visuals> Data Labels > Options> Inside Center
➢ Visualizations >Format Visuals> Data Labels> Values > Font Size = 14
➢ Visualizations >Format Visuals> Title> Text =”sum of profit by quarter name”
➢ Visualizations >Format Visuals> Title> Font Size =20
➢ Visualizations >Format Visuals> Effects> Background Color = #6b0010

8. Create Stacked Column Chart:


➢ Visualizations >Build Visuals >Fields > Y –Axis =”sum of profit”
➢ Visualizations >Build Visuals >Fields > X-Axis =”week number”
➢ For weeknum data field create a new column measure
➢ Orders->NewColumn->and enter the below dax formula:
WeekNum = WEEKNUM(Orders[Order Date].[Date])
➢ Visualizations >Format Visuals> Y-axis> Values >Color = #374649
➢ Visualizations >Format Visuals> Y-axis> Values >Title >Color = #5
➢ Visualizations >Format Visuals> X-axis> Values >Color = #374649
➢ Visualizations >Format Visuals> X-axis> Values >Title >Color = #5F6B6D
➢ Visualizations >Format Visuals> Bar> Show All
➢ Visualizations >Format Visuals> Data Labels > Options> Inside Center
➢ Visualizations >Format Visuals> Data Labels> Values > Font Size = 14
➢ Visualizations >Format Visuals> Title> Text =”sum of profit by week num”
➢ Visualizations >Format Visuals> Title> Font Size =20
➢ Visualizations >Format Visuals> Effects> Background Color = #EO0047

59
9. Create Stacked Column Chart:
➢ Visualizations >Build Visuals >Fields > Y –Axis =”sum of profit”
➢ Visualizations >Build Visuals >Fields > X-Axis =”week day”
➢ For weekday data field create a new column measure
➢ Orders->NewColumn->and enter the below dax formula:
WeekDay = WEEKDAY(Orders[Order Date].[Date])
➢ Visualizations >Format Visuals> Y-axis> Values >Color = #374649
➢ Visualizations >Format Visuals> Y-axis> Values >Title >Color = #5
➢ Visualizations >Format Visuals> X-axis> Values >Color = #374649
➢ Visualizations >Format Visuals> X-axis> Values >Title >Color = #5F6B6D
➢ Visualizations >Format Visuals> Bar> Show All
➢ Visualizations >Format Visuals> Data Labels > Options> Inside Center
➢ Visualizations >Format Visuals> Data Labels> Values > Font Size = 14
➢ Visualizations >Format Visuals> Title> Text =”sum of profit by week day”
➢ Visualizations >Format Visuals> Title> Font Size =20
Visualizations >Format Visuals> Effects> Background Color = #ebf567

60
10. Create Stacked Column Chart:
➢ Visualizations >Build Visuals >Fields > Y –Axis =”sum of profit”
➢ Visualizations >Build Visuals >Fields > X-Axis =”day of week name”
➢ For weekname data field create a new column measure
➢ Orders->NewColumn->and enter the below dax formula:
Day of weekName = FORMAT(Orders[Order Date],"dddd")
➢ Visualizations >Format Visuals> Y-axis> Values >Color = #374649
➢ Visualizations >Format Visuals> Y-axis> Values >Title >Color = #5
➢ Visualizations >Format Visuals> X-axis> Values >Color = #374649
➢ Visualizations >Format Visuals> X-axis> Values >Title >Color = #5F6B6D
➢ Visualizations >Format Visuals> Bar> Show All
➢ Visualizations >Format Visuals> Data Labels > Options> Inside Center
➢ Visualizations >Format Visuals> Data Labels> Values > Font Size = 14
➢ Visualizations >Format Visuals> Title> Text =”sum of profit by day of week name”
➢ Visualizations >Format Visuals> Title> Font Size =20
➢ Visualizations >Format Visuals> Effects> Background Color = #a0A078

11. Create Stacked Column Chart:


➢ Visualizations >Build Visuals >Fields > Y –Axis =”sum of profit”
➢ Visualizations >Build Visuals >Fields > X-Axis =”year”
➢ For year data field create a new column measure
➢ Orders->NewColumn->and enter the below dax formula:
➢ year = YEAR(Orders[Order Date].[Date])
➢ Visualizations >Format Visuals> Y-axis> Values >Color = #374649
➢ Visualizations >Format Visuals> Y-axis> Values >Title >Color = #5
➢ Visualizations >Format Visuals> X-axis> Values >Color = #374649
➢ Visualizations >Format Visuals> X-axis> Values >Title >Color = #5F6B6D
➢ Visualizations >Format Visuals> Bar> Show All
➢ Visualizations >Format Visuals> Data Labels > Options> Inside Center
➢ Visualizations >Format Visuals> Data Labels> Values > Font Size = 14
➢ Visualizations >Format Visuals> Title> Text =”sum of profit by year”

61
➢ Visualizations >Format Visuals> Title> Font Size =20
➢ Visualizations >Format Visuals> Effects> Background Color = #a0A078

12. Create table:

➢ Home > Enter data > Create table by giving values to the columns
➢ Visualizations >Columns>orderDate>profit>previousYear Profit
➢ Orders->NewColumn->and enter the below dax formula:
previousDayProfit = CALCULATE(SUM(Orders[Profit]),PREVIOUSDAY(Orders[Order Date].[Date]))

13. Create table:

➢ Home > Enter data > Create table by giving values to the columns
➢ Visualizations >Columns>orderDate>profit>previousMonthProfit
➢ Orders->NewColumn->and enter the below dax formula:
previousMonthProfit = CALCULATE(SUM(Orders[Profit]),PREVIOUSMONTH(Orders[Order Date].[Date]))

62
14. Create table:

➢ Home > Enter data > Create table by giving values to the columns
➢ Visualizations >Columns>orderDate>profit>previousqtrProfit
➢ Orders->NewColumn->and enter the below dax formula:
previousqtrProfit = CALCULATE(SUM(Orders[Profit]),PREVIOUSQUARTER(Orders[Order
Date].[Date]))

15. Create table:

➢ Home > Enter data > Create table by giving values to the columns
➢ Visualizations >Columns>orderDate>profit>previousyearprofit
➢ Orders->NewColumn->and enter the below dax formula:
previousyearProfit = CALCULATE(SUM(Orders[Profit]),PREVIOUSYEAR(Orders[Order Date].[Date]))

16. Create Clustered Column Chart:


➢ Visualizations >Build Visuals >Fields > Y –Axis =”sum of profit,previousyearprofit”
➢ Visualizations >Build Visuals >Fields > X-Axis =”order date”

➢ For previousyearprofit data field create a new column measure


➢ Orders->NewColumn->and enter the below dax formula:
previousyearProfit = CALCULATE(SUM(Orders[Profit]),PREVIOUSYEAR(Orders[Order Date].[Date]))
➢ Visualizations >Format Visuals> Y-axis> Values >Color = #374649
➢ Visualizations >Format Visuals> Y-axis> Values >Title >Color = #5
➢ Visualizations >Format Visuals> X-axis> Values >Color = #374649
➢ Visualizations >Format Visuals> X-axis> Values >Title >Color = #5F6B6D
➢ Visualizations >Format Visuals> Bar> Show All

63
➢ Visualizations >Format Visuals> Data Labels > Options> Inside Center
➢ Visualizations >Format Visuals> Data Labels> Values > Font Size = 14
➢ Visualizations >Format Visuals> Title> Text =”sum of profit and previousprofit by year”
➢ Visualizations >Format Visuals> Title> Font Size =20
➢ Visualizations >Format Visuals> Effects> Background Color = #E044A7

17. Create Clustered Column Chart:


➢ Visualizations >Build Visuals >Fields > Y –Axis =”sum of profit,previousqtrprofit”
➢ Visualizations >Build Visuals >Fields > X-Axis =”order date”
➢ For previousqtrprofit data field create a new column measure
➢ Orders->NewColumn->and enter the below dax formula:
previousqtrProfit = CALCULATE(SUM(Orders[Profit]),PREVIOUSQUARTER(Orders[Order
Date].[Date]))
➢ Visualizations >Format Visuals> Y-axis> Values >Color = #374649
➢ Visualizations >Format Visuals> Y-axis> Values >Title >Color = #5
➢ Visualizations >Format Visuals> X-axis> Values >Color = #374649
➢ Visualizations >Format Visuals> X-axis> Values >Title >Color = #5F6B6D
➢ Visualizations >Format Visuals> Bar> Show All
➢ Visualizations >Format Visuals> Data Labels > Options> Inside Center
➢ Visualizations >Format Visuals> Data Labels> Values > Font Size = 14
➢ Visualizations >Format Visuals> Title> Text =”sum of profit and previousqtrprofit by
quarter”
➢ Visualizations >Format Visuals> Title> Font Size =20
➢ Visualizations >Format Visuals> Effects> Background Color = #fc67e9

64
18. Create Clustered Column Chart:
➢ Visualizations >Build Visuals >Fields > Y –Axis =”sum of profit,nextqtrprofit”
➢ Visualizations >Build Visuals >Fields > X-Axis =”order date”
➢ For nextqtrprofit data field create a new column measure
➢ Orders->NewColumn->and enter the below dax formula:
nextquarterProfit = CALCULATE(SUM(Orders[Profit]),NEXTQUARTER(Orders[Order Date].[Date]))
Visualizations >Format Visuals> Y-axis> Values >Color = #374649
➢ Visualizations >Format Visuals> Y-axis> Values >Title >Color = #5
➢ Visualizations >Format Visuals> X-axis> Values >Color = #374649
➢ Visualizations >Format Visuals> X-axis> Values >Title >Color = #5F6B6D
➢ Visualizations >Format Visuals> Bar> Show All
➢ Visualizations >Format Visuals> Data Labels > Options> Inside Center
➢ Visualizations >Format Visuals> Data Labels> Values > Font Size = 14
➢ Visualizations >Format Visuals> Title> Text =”sum of profit and nextqtrprofit by year”
➢ Visualizations >Format Visuals> Title> Font Size =20
Visualizations >Format Visuals> Effects> Background Color = #e1c233

19. Create table:

➢ Home > Enter data > Create table by giving values to the columns
➢ Visualizations >Columns>orderDate>profit>nextmonthprofit
➢ Visualizations >Columns>orderDate>profit>nextquarterprofit
➢ Visualizations >Columns>orderDate>profit>nextyearprofit
➢ Orders->NewColumn->and enter the below dax formula:
nextmonthProfit = CALCULATE(SUM(Orders[Profit]),NEXTMONTH(Orders[Order Date].[Date]))
nextquarterProfit = CALCULATE(SUM(Orders[Profit]),NEXTQUARTER(Orders[Order Date].[Date]))
nextyearProfit = CALCULATE(SUM(Orders[Profit]),NEXTYEAR(Orders[Order Date].[Date])

65
20. Create Clustered Column Chart:
➢ Visualizations >Build Visuals >Fields > Y –Axis =”sum of profit,nextyearprofit”
➢ Visualizations >Build Visuals >Fields > X-Axis =”order date”
➢ For nextqtrprofit data field create a new column measure
➢ Orders->NewColumn->and enter the below dax formula:
nextyearProfit = CALCULATE(SUM(Orders[Profit]),NEXTYEAR(Orders[Order Date].[Date]))
Visualizations >Format Visuals> Y-axis> Values >Color = #374649
➢ Visualizations >Format Visuals> Y-axis> Values >Title >Color = #5
➢ Visualizations >Format Visuals> X-axis> Values >Color = #374649
➢ Visualizations >Format Visuals> X-axis> Values >Title >Color = #5F6B6D
➢ Visualizations >Format Visuals> Bar> Show All
➢ Visualizations >Format Visuals> Data Labels > Options> Inside Center
➢ Visualizations >Format Visuals> Data Labels> Values > Font Size = 14
➢ Visualizations >Format Visuals> Title> Text =”sum of profit and nextyearprofit by
year,quarter,month and day”
➢ Visualizations >Format Visuals> Title> Font Size =20
Visualizations >Format Visuals> Effects> Background Color = #f5ac4af

66
21. Create table:

➢ Home > Enter data > Create table by giving values to the columns
➢ Visualizations >Columns>orderDate>profit>3daysaheadprofit
➢ Visualizations >Columns>orderDate>profit>3daysbackprofit
➢ Orders->NewColumn->and enter the below dax formula:
3daysaheadprofit = CALCULATE(sum(Orders[Profit]),DATEADD(Orders[Order Date].[Date],3,DAY))
3DaysBackprofit = CALCULATE(sum(Orders[Profit]),DATEADD(Orders[Order Date].[Date],-3,DAY))

22. Create table:

➢ Home > Enter data > Create table by giving values to the columns
➢ Visualizations >Columns>orderDate>profit>3monthsaheadprofit
➢ Visualizations >Columns>orderDate>profit>3monthsbackprofit
➢ Orders->NewColumn->and enter the below dax formula:
3monthsaheadprofit = CALCULATE(sum(Orders[Profit]),DATEADD(Orders[Order
Date].[Date],3,MONTH))
3monthsBackprofit = CALCULATE(sum(Orders[Profit]),DATEADD(Orders[Order Date].[Date],-
3,MONTH))

23. Create table:


➢ Home > Enter data > Create table by giving values to the columns
➢ Visualizations >Columns>orderDate>profit>3quarteraheadprofit
➢ Visualizations >Columns>orderDate>profit>3quarterbackprofit

67
➢ Orders->NewColumn->and enter the below dax formula:

3quartersaheadprofit = CALCULATE(sum(Orders[Profit]),DATEADD(Orders[Order
Date].[Date],3,QUARTER))
3quartersBackprofit = CALCULATE(sum(Orders[Profit]),DATEADD(Orders[Order Date].[Date],-
3,QUARTER))

24. Create table:


➢ Home > Enter data > Create table by giving values to the columns
➢ Visualizations >Columns>orderDate>profit>3yearsaheadprofit
➢ Visualizations >Columns>orderDate>profit>3yearsbackprofit
➢ Orders->NewColumn->and enter the below dax formula:
3yearsaheadprofit = CALCULATE(sum(Orders[Profit]),DATEADD(Orders[Order
Date].[Date],3,year))
3yearsBackprofit = CALCULATE(sum(Orders[Profit]),DATEADD(Orders[Order Date].[Date],-
3,year))

25. Create Clustered Column Chart:


➢ Visualizations >Build Visuals >Fields > Y –Axis =”sum of
profit,3yearsbackprofit,3yearsaheadprofit”
➢ Visualizations >Build Visuals >Fields > X-Axis =”order date”
➢ For 3yearsaheadprofit, 3yearsBackprofit data field create a new column measure
➢ Orders->NewColumn->and enter the below dax formula:
3yearsaheadprofit = CALCULATE(sum(Orders[Profit]),DATEADD(Orders[Order
Date].[Date],3,year))
3yearsBackprofit = CALCULATE(sum(Orders[Profit]),DATEADD(Orders[Order Date].[Date],-
3,year))
Visualizations >Format Visuals> Y-axis> Values >Color = #374649
➢ Visualizations >Format Visuals> Y-axis> Values >Title >Color = #5
➢ Visualizations >Format Visuals> X-axis> Values >Color = #374649
➢ Visualizations >Format Visuals> X-axis> Values >Title >Color = #5F6B6D
➢ Visualizations >Format Visuals> Bar> Show All

68
➢ Visualizations >Format Visuals> Data Labels > Options> Inside Center
➢ Visualizations >Format Visuals> Data Labels> Values > Font Size = 14
➢ Visualizations >Format Visuals> Title> Text =”sum of profit ,3yearsaheadprofit and
3yearsbackprofit by year.
➢ Visualizations >Format Visuals> Title> Font Size =20
Visualizations >Format Visuals> Effects> Background Color = #f0af87

26. Create Clustered Column Chart:


➢ Visualizations >Build Visuals >Fields > Y –Axis =”sum of
profit,3quartersbackprofit,3quarteraheadprofit”
➢ Visualizations >Build Visuals >Fields > X-Axis =”order date”
➢ For 3yearsaheadprofit , 3yearsBackprofit data field create a new column measure
➢ Orders->NewColumn->and enter the below dax formula:
3quartersaheadprofit = CALCULATE(sum(Orders[Profit]),DATEADD(Orders[Order
Date].[Date],3,QUARTER))
3quartersBackprofit = CALCULATE(sum(Orders[Profit]),DATEADD(Orders[Order Date].[Date],-
3,QUARTER))
Visualizations >Format Visuals> Y-axis> Values >Color = #374649
➢ Visualizations >Format Visuals> Y-axis> Values >Title >Color = #5
➢ Visualizations >Format Visuals> X-axis> Values >Color = #374649
➢ Visualizations >Format Visuals> X-axis> Values >Title >Color = #5F6B6D
➢ Visualizations >Format Visuals> Bar> Show All
➢ Visualizations >Format Visuals> Data Labels > Options> Inside Center
➢ Visualizations >Format Visuals> Data Labels> Values > Font Size = 14
➢ Visualizations >Format Visuals> Title> Text =”sum of profit ,3yearsaheadprofit and
3yearsbackprofit by year.
➢ Visualizations >Format Visuals> Title> Font Size =20
➢ Visualizations >Format Visuals> Effects> Background Color = # E044A7

69
27. Create table:

➢ Home > Enter data > Create table by giving values to the columns
➢ Visualizations >Columns>orderDate>profit>sameperiodlastyearprofit
➢ Orders->NewColumn->and enter the below dax formula:
sameperiodlastyearprofit = CALCULATE(SUM(Orders[Profit]),SAMEPERIODLASTYEAR(Orders[Order
Date].[Date]))

28. Create Line Chart:


➢ Visualizations >Build Visuals >Fields > Y –Axis =”sum of profit,”
➢ Visualizations >Build Visuals >Fields >Seconadray- Y –Axis =sameperiodlastyear”
➢ Visualizations >Build Visuals >Fields > X-Axis =”order date”
➢ For sameperiodlastyear data field create a new column measure
➢ Orders->NewColumn->and enter the below dax formula:
sameperiodlastyearprofit = CALCULATE(SUM(Orders[Profit]),SAMEPERIODLASTYEAR(Orders[Order
Date].[Date]))
Visualizations >Format Visuals> Y-axis> Values >Color = #374649
➢ Visualizations >Format Visuals> Y-axis> Values >Title >Color = #5
➢ Visualizations >Format Visuals> X-axis> Values >Color = #374649
➢ Visualizations >Format Visuals> X-axis> Values >Title >Color = #5F6B6D
➢ Visualizations >Format Visuals> Bar> Show All
➢ Visualizations >Format Visuals> Data Labels > Options> Inside Center
➢ Visualizations >Format Visuals> Data Labels> Values > Font Size = 14
➢ Visualizations >Format Visuals> Title> Text =”sum of profit and
sameperiodlastyearprofit by year and month”
➢ Visualizations >Format Visuals> Title> Font Size =20
➢ Visualizations >Format Visuals> Effects> Background Color = # Ef567w

70
Final Output:

71
72
Experiment Number: 08

Aim:

Create reports using MTD,YTD,QTD In power-bi?


Procedure:

1. Importing the Dataset:

➢ Launch Power BI Desktop.


➢ Click on "Get Data" in the Home tab of the ribbon.
➢ Select the appropriate data source option "Excel” and follow the prompts to import yoursample
dataset into Power BI.

2. Insert Rectangle Shape:

o Click on “Format tab” on right side and perform changes on visual.


o Shape > Style > #E66C37
o Shape > Text >Text = “Page1” , Font Size = 46, Horizontal Alignment = “Center”.

73 | V V I T D e p t o f C
3. Create table:

➢ Home > Enter data > Create table by giving values to the columns
➢ Visualizations >Columns>orderDate>Quantity>mtd item quantity
➢ Click on new measure>and enter the below dax formula:
Mtd item qty = TOTALMTD(SUM(Orders[Quantity]),Orders[Order Date].[Date])

4. Create table:
➢ Home > Enter data > Create table by giving values to the columns
➢ Visualizations >Columns>orderDate>Quantity>qtd item quantity
➢ Click on new measure>and enter the below dax formula:
qtd item qty = TOTALQTD(SUM(Orders[Quantity]),Orders[Order Date].[Date])

5. Create table:
➢ Home > Enter data > Create table by giving values to the columns
➢ Visualizations >Columns>orderDate>Quantity>ytd item quantity
➢ Click on new measure>and enter the below dax formula:
Ytd item qty = TOTALYTD(SUM(Orders[Quantity]),Orders[Order Date].[Date])

73 | V V I T D e p t o f C
6. Create table:

➢ Home > Enter data > Create table by giving values to the columns
➢ Visualizations >Columns>orderDate>Total Mtd Orders
➢ Visualizations >Columns>orderDate>Total qtd Orders
➢ Visualizations >Columns>orderDate>Total ytd Orders
➢ Click on new measure>and enter the below dax formula:
Total Mtd Orders = TOTALMTD(Count(Orders[Order ID]),Orders[Order Date].[date])
Total Qtd Orders = TOTALQTD(Count(Orders[Order ID]),Orders[Order Date].[date])
Total Ytd Orders = TOTALYTD(Count(Orders[Order ID]),Orders[Order Date].[date])

7. Create table:
➢ Home > Enter data > Create table by giving values to the columns
➢ Visualizations >Columns>orderDate>profit>mtdProfit
➢ Click on new measure>and enter the below dax formula:
MTDprofit = CALCULATE(sum(Orders[Profit]),DATESMTD(Orders[Order Date].[Date]))

8. Create table:
➢ Home > Enter data > Create table by giving values to the columns
➢ Visualizations >Columns>orderDate>profit>qtdProfit
➢ Click on new measure>and enter the below dax formula:
QTDprofit = CALCULATE(sum(Orders[Profit]),DATESQTD(Orders[Order Date].[Date]))

|VVIT Dept of CSE


9..Create table:
➢ Home > Enter data > Create table by giving values to the columns
➢ Visualizations >Columns>orderDate>profit>ytdProfit
➢ Click on new measure>and enter the below dax formula:
YTDprofit = CALCULATE(sum(Orders[Profit]),DATESYTD(Orders[Order Date].[Date]))

|VVIT Dept of CSE


Final Output:

|VVIT Dept of CSE


|VVI T D e pt o f C SE
Experiment Number: 09

Aim: Create Reports using Filter Functions in DAX

1.Importing the Dataset:

➢ Launch Power BI Desktop.


➢ Click on "Get Data" in the Home tab of the ribbon.
➢ Select the appropriate data source option "Excel” and follow the
prompts to import yoursample dataset into Power BI.
➢ Select sample-super store data,xsl
➢ Select orders table from the check-boxws.

2. Insert Rectangle Shape:

➢ Click on “Format tab” on right side and perform changes on visual.


➢ Shape > Style > #E66C37
➢ Shape > Text >Text = “Page1” , Font Size = 46, Horizontal Alignment =
“Center”.

|VVI T D e pt o f C SE
3. Create Table:
➢ Create table and place it in the report
➢ In the fields column drag and drop category

4. Create Table for calculating profits:

➢ Home > Enter data > Create table by giving values to the columns
➢ Click on new measure>and enter the below dax formula:
Total Profit = SUM(Orders[profit])
➢ Visualizations >Columns>Total profit

5. Applying ALL-Filter:

Syntax: ALL(<table>|<column>].<column>[,…]]]])
Description: returns all the rows in a table or all the values in the column,
ignoring any filters that have been applied. This function is useful for clearing
filters and creating calculations or all the rows in a table
➢ Home > Enter data > Create table by giving values to the columns
➢ Click on new measure>and enter the below dax formula:
All profit filter = CALCULATE([Total Profit],ALL(orders))

80
6. Applying ALLAccept:

Syntax: ALLACCEPT(<table>|<column>].<column>[,…]]]])
Description: returns all the rows in a table or all the values in the column,
ignoring any filters that have been applied except the given coulmn. This function
is useful for clearing filters and creating calculations or all the rows in a table
except given column.
➢ Home > Enter data > Create table by giving values to the columns
➢ Click on new measure>and enter the below dax formula:
All profit Except Cat = CALCULATE([Total
Profit],ALLEXCEPT(Orders,Orders[Category]))
➢ Visualizations >Columns>All profit Except cat

7. calculating % of profit for each category:

➢ Home > Enter data > Create table by giving values to the columns

➢ Click on new measure>and enter the below dax formula:


%profit Cat = DIVIDE([Total Profit],[All profit filter])
➢ Visualizations >Columns>%profit cat
➢ Change the mode to %

8. Applying filter to a particular Column:


➢ Home > Enter data > Create table by giving values to the columns
➢ Click on new measure>and enter the below dax formula:
technology profit = CALCULATE([total profit],Orders[category]="Technology"]
➢ Visualizations >Columns>technology profit

81
9. Applying Keep-Filter:
Syntax: KEEPFILTERS(<Expression>)
Description: Modifies how filters are applied for evaluating.

➢ Home > Enter data > Create table by giving values to the columns
➢ Click on new measure>and enter the below dax formula:
(KP)Technology profit = calculate([Total Profit],keepfilters(orders[category]="Technology"))
➢ Visualizations >Columns>(KP)Technology Profit

10. Applying REMOVE-Filter:

Syntax: RemoveFilter(.<column>[,…]]]])
Description: same as all filter but not returns all the rows in a table or all the
values in the column, ignoring any filters that have been applied. Majorly used for
reducing complexity and increasing performance. This function is useful for
clearing filters and creating calculations or all the rows in a table
➢ Home > Enter data > Create table by giving values to the columns
➢ Click on new measure>and enter the below dax formula:
All Profit RF filter = calculate([total profit],REMOVEFILTERS(Orders[category]))
➢ Visualizations >Columns>All profit RF filter

82
11. Creating a slicer for comparision:
➢ Home>visulazation>build visual>select slicer
➢ Chose religion in the fields
➢ From setting change the slicer settings>
➢ Choose style as tile

comparison:
if region=central

if region=south:

83
if region=East:

if region=West:

12. Create Table:


➢ Home > Enter data > Create table by giving values to the columns
➢ Click on new measure>and enter the below dax formula:
➢ Profit rank = RANKX(ALL(Orders[region]),[total profit],,desc
➢ Visualizations >Columns>religion>profit>profit rank

84
13. Output:

85
86
Experiment Number: 10

Aim:To publish the Power-BI project report and create a dashboard


Procedure:
2. Open the Report View:
➢ Open the Power-bi file that is needed to be published
➢ Open the report view of the document

3. Sign-in to your Microsoft Account:


➢ On the right side of the page click on the sign in-button
➢ A page appears as below.

87
➢ Enter the Email or the select the email in the drop down list shown.
➢ A page appears as follows:

➢ Enter the password and click on the sign-in button


➢ Now,your signed-in to your Microsoft account.

4. Publish your Report:


➢ Click on the publish icon on the right-side of the document.
➢ A page appears as follows:

➢ Click on the My workspace from the drop-down menu


➢ And follow by clicking on the select button.
➢ A page appears as follows.

88
➢ After successfully publishing the report a dialog-box appears as below:

5. View the Report:


➢ Open your browser
➢ Search for App.powerbi.com
➢ A page appears as below.

➢ Sign in to your Microsoft account.


➢ Click on the My Workspace icon that is viewed on the left-side of the page.
89
➢ The documents you have published can be viewed on this page

6. Pin To DashBoard:
➢ We,can also create dashboards for all the important data that is needed to view more
oftenly.
➢ For Example there are 2 pages in the report we have published i.e.profit and sales.
➢ So if we need to view sales page often we can create a dashboard for it.
➢ Open the page and click on the three dots that are visible on the righ side of the page
➢ The page appears as below.

➢ Click on the pin to a dashboard option.


➢ Two options are shown as below:

90
➢ We can pin it to new dashboard or an existing dashboard.
➢ Give a suitable dashboard name
➢ After clicking on pin-live the pinned page will be shown as follows.

➢ Similarly publish all the power-bi files that have being done.

7. Final Report:

➢ After publishing all the documents,open the browser.


➢ Sign in to your account
➢ Click on My Workspaces.
➢ Along with the published documents the pinned reports will be shown on your dashboard.

91
8. Final Output:

The pinned pages will be appeared as below in the dashboard

All the reports you have published will be shown in workspace as shown below:

92
Regd.No: 20BQ1A05

93
Regd.No: 20BQ1A05

94
Regd.No: 20BQ1A05

95

You might also like