0% found this document useful (0 votes)
52 views10 pages

07 Introduction To DAX

This document provides an introduction to DAX, the query and calculation language used in Power BI. It discusses key DAX concepts like tables, columns, functions and operators. It also explains the different uses of DAX, including calculated columns, measures, and calculated tables. Calculated columns derive column values immediately during data load, measures aggregate column values for reports, and calculated tables derive entire tables of values from relationships between other tables.

Uploaded by

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

07 Introduction To DAX

This document provides an introduction to DAX, the query and calculation language used in Power BI. It discusses key DAX concepts like tables, columns, functions and operators. It also explains the different uses of DAX, including calculated columns, measures, and calculated tables. Calculated columns derive column values immediately during data load, measures aggregate column values for reports, and calculated tables derive entire tables of values from relationships between other tables.

Uploaded by

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

07 – Introduction To DAX

Chris Webb
[email protected]
Agenda
• What is DAX?
• DAX concepts, syntax and functions
• Calculated columns
• Measures
• Calculated tables
What is DAX?
• DAX is the native calculation and query language for Power BI (and
Power Pivot and SQL Server Analysis Services Tabular)
• DAX design goals were:
• Make it easy to do common calculations
• Make it easy to use for Excel power users, hence the Excel-based syntax
Tables and Columns
• The data that you work with in DAX is to be found in tables
• Tables are made up of columns
• Columns are how you refer to the data you need for calculations
• Refer to tables in DAX using the format
‘My Table Name’
• Refer to columns in DAX using the format
‘My Table Name’[My Column Name]
• Intellisense will help you find the objects you’re looking for
DAX Syntax, Functions And Operators
• DAX syntax, functions and operators are mostly consistent with Excel
• About 80 Excel functions are supported directly – other functions are
for things that Excel has no concept of
• The only things that may need remembering are:
• &&, || and ! are used for AND, OR and NOT operators
• & is used for string concatenation
• Blank() is a data type similar to null in relational databases
Uses Of DAX
• DAX can be used to create:
• Calculated Columns
• Measures
• Calculated Tables
• DAX is also a query language – though you can’t use DAX queries
inside Power BI itself
• Power BI generates DAX queries to get the data for reports
• Use DAX Studio (https://daxstudio.codeplex.com/) to run DAX queries on your
Power BI model
Calculated Columns
• Calculated columns are derived columns in a Data Model table
• They are defined on the Modelling tab of the Data or Report view
• After they are created, they behave like any other column
• Though compression might be slightly less efficient
• Their values are calculated immediately after data has been loaded
into the Data Model
• They can be used to do basic ETL work, eg concatenating first and last
names, deriving years from dates etc
• Easier to do this with a query when importing?
Measures
• Measures = data + aggregation
• Basic example to aggregate values in a column by summing:
MyMeasure = SUM(‘My Table Name’[My Column Name])
• They provide the numeric values you see aggregated in reports
• They can be created in two ways:
• By dragging a column into a report then telling Power BI how to aggregate the
values for that particular case
• More advanced measures can be created by creating an explicit measure and
entering your own DAX expression
• Measures are always evaluated when the report is refreshed
Calculated Columns or Measures?
• A common question from new Power BI users is “Should I used
Calculated Columns or Measures?”
• Most of the time, you can only use one or the other for a task
• You need a measure if you need to see an aggregated value inside the
body of a table, matrix or other visualisation
• You need a calculated column if you need to see an unaggregated
value but nevertheless calculated value in a report
Calculated Tables
• Calculated Tables are tables in the Data Model whose contents are
derived from data in other tables
• They are defined using a DAX expression that returns a table of values
• Again, there is an overlap between what you can do here and what
you can do in with queries when importing data

You might also like