0% found this document useful (0 votes)
31 views14 pages

Power Bi Course 4

The document provides an overview of Data Analysis Expressions (DAX) including its functions and usage. It discusses DAX syntax and functions like aggregation, measures, calculations, dates, and logical/filter functions. It also includes examples of using DAX to analyze a sample dataset and calculate metrics like profits, orders, and profit margins.
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)
31 views14 pages

Power Bi Course 4

The document provides an overview of Data Analysis Expressions (DAX) including its functions and usage. It discusses DAX syntax and functions like aggregation, measures, calculations, dates, and logical/filter functions. It also includes examples of using DAX to analyze a sample dataset and calculate metrics like profits, orders, and profit margins.
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/ 14

Data Analysis & Visualization

with Microsoft Power BI


Rizwan Mushtaq
[email protected]
DAX
Data Analysis Expressions
DAX: Data Analysis Expressions
• DAX is a formula language with functions
• It could be used to create new information from the data
• Period-to-period comparisons are easy

• DAX: Calculated Columns & Measures


DAX: Data Analysis Expressions

• DAX: Syntax
DAX
• Download “contoso sales sample for power bi”
• https://www.microsoft.com/en-us/download/details.aspx?id=46801
DAX Functions
• DAX Aggregate Functions
• DAX Measures & Calculate Column Functions
• Basic DAX Date & Time Functions
• DAX: Logical & Filter Functions
DAX Aggregate Functions
1. SUM function
Using newly created measure (total sales by brand/manufacturer)
2. AVERAGE
3. Count function (count the number of products)
4. Countblank (to see missing and blanks cells)
5. Distinctcount (counts each unique value-count stores from sales table/storek )
6. Countrows (in a table)
7. Formatting a function
Comment, delete, edit and renaming a function
DAX Measures & Calculate Column Functions

1. Calculate gross profit of the company (Sales-cost) in a new column

2. Create a measure with operators-Calculate net sales of the company (Sales-


Discount-Returns)
• Add your new Net Sales measure to the report canvas and calculate net sales for
whatever other fields you add to the report. (net sales by country, add total sales)

3. DIVIDE (Gross profit %) gross profit/sales


Basic DAX Date & Time Functions: DAX

• How many days a particular promotion ran ?


DAX: Logical & Filter Functions
1. FIND
2. IF (find & if are often used together)
3. OR
4. SIMPLE FILTER with CALCULATE Function
DAX: Logical & Filter Functions
5. SWITCH

• If contoso print internal


• If fabrikam prinint internal
• Else external
DAX: Practice Session
• Download Sales.csv data file from Blackboard
• Import Sales.csv into Power BI
• Take a look at the data

1. Company wants to calculate the profit of each product line/transaction, which


product is more profitable ?

2. Company wants to see the trend of orders (hint: distinctcount function)


Show the newly created measure with line chart along with order date.

3. Company wants to calculate the profit margin ratio (this ratio is in %age), the formula
is as follows (Total Profit/Total Sales)
Show with line chart, in which year company has higher profit margin
DAX: Practice Session
4. Create a AvgProfit measure which takes the average of all the profit.

5. Company management wants to know Sales by category (“Bikes”) and year


(2018)----(hint: CALCULATE, sum of line price and then use two filters)
Sources
• DataCamp (Introduction to DAX, Intermediate DAX)
• LinkDin Learning
• Microsoft Learnning

You might also like