0% found this document useful (0 votes)
34 views80 pages

DAX Zero To Developer

The document provides a comprehensive guide on DAX (Data Analysis Expressions), covering essential concepts such as data types, operators, and evaluation contexts. It explains the differences between data and lookup tables, primary and foreign keys, as well as the functionality of measures and calculated columns. Additionally, it includes best practices for writing DAX code, performance tuning, and error handling techniques.

Uploaded by

AVISHEKH GANGULY
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)
34 views80 pages

DAX Zero To Developer

The document provides a comprehensive guide on DAX (Data Analysis Expressions), covering essential concepts such as data types, operators, and evaluation contexts. It explains the differences between data and lookup tables, primary and foreign keys, as well as the functionality of measures and calculated columns. Additionally, it includes best practices for writing DAX code, performance tuning, and error handling techniques.

Uploaded by

AVISHEKH GANGULY
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/ 80

DAX

ZERO TO DEVELOPER

by Tajamul Khan
PREREQUISITES DAX Comments TIME INTELLIGENCE
Data vs Lookup tables Error Handling Data Table
Primary vs Foreign Key Variables Calendar
Cardinality SCALAR FUNCTIONS Performance Till Date
Filter Flow Aggregate Functions Time Period Shift

CONTENTS
Iterator Functions Running Total Functions
DAX
Introduction Round Functions PERFORMANCE TUNING

Engines Information Functions Performance Analyser


Data Types Logical Function DAX Studio
Operators
CALCULATE
Vertipaq
Calculated Columns Introduction
Pillars
Measures
Evaluation Context
TABLE FUNCTIONS
GOOD PRACTICES Filter Data Functions
Naming Conventions Table Joins
Evaluation Order Relation Functions
DAX Shortcuts
PREREQUISITES
Data Blogs Follow Tajamul Khan

DATA VS LOOKUP TABLE


DATA TABLE
contain measurable values or metrics about the business (quantity, revenue, pageviews)

LOOKUP TABLES
provide descriptive attributes about each dimension in your model (customers, products)

DATA TABLE LOOKUP TABLE


Purpose Stores detailed transactional data Stores reference or descriptive data

Example Sales transactions, Inventory etc Product categories, employee departments

Key Foreign Key Primary Key

Use Aggregations Slicers, Filters

1
Data Blogs Follow Tajamul Khan

PRIMARY KEY VS FOREIGN KEY


PRIMARY KEY
they uniquely identify each row of a table and cannot have NULL values

FOREIGN KEY
they contain multiple instances of each value, and are used to match the primary keys
in related lookup tables

PRIMARY KEY FOREIGN KEY


Purpose Uniquely identifies rows in table Links records from different tables

Condition must be unique can have duplicates

Values No Null Can have Null

2
Data Blogs Follow Tajamul Khan

CARDINALITY
refers to the uniqueness of values in a column. It can be of many types
One to Many
Many to One
Many to Many
One to One
For our purposes, all relationships in the data model should follow a “one to many”
cardinality; one instance of each primary key to many instances of each foreign key

FILTER FLOW
Filter Flow always runs “ downstream ” from Lookup to Data Table
Filters cannot flow “ upstream ” (against the direction)

3
DAX
Data Blogs Follow Tajamul Khan

DAX
DAX also known as Data Analysis Expressions is a functional
language i.e. the execution flows with function calls, It is used in
Power BI
Analysis Services Tabular
Power Pivot
It resembles excel because it was born with PowerPivot

FORMATTING
Code formatting is of paramount importance in DAX.

=SUMX (FILTER ( VALUES ( 'Date'[Year] ), 'Date'[Year] < 2005),


IF ( 'Date'[Year] >= 2000,
[Sales Amount] * 100,
[Sales Amount] * 90) )

4
Data Blogs Follow Tajamul Khan

DAX ENGINES
DAX is powered by two internal engines (formula engine & storage engine) which
work together to compress & encode raw data and evaluate DAX queries

FORMULA ENGINE
Receives, interprets and executes all DAX requests
Processes the DAX query then generates a list of logical steps called a query plan
Works with the datacache sent back from the storage engine to evaluate the DAX
query and return a result

STORAGE ENGINE
Compresses and encodes raw data, and only communicates with the formula engine
(doesn’t understand the DAX language)
Receives a query plan from Formula Engine, executes it, and returns a datacache

5
Data Blogs Follow Tajamul Khan

DAX ENGINE WORKING


Query
Plan

DAX Query
Formula
Storage
Engine
Engine

Output
Data
Cache

6
Data Blogs Follow Tajamul Khan

DATA TYPES
Integer (64 bit) Whole Number
DAX TYPE HANDLING
Decimal (Floating Point) OPERATOR OVERLOADING
Currency (Fixed Decimal Number) Operators are not strongly typed
The result depends on the inputs
Date, DateTime, Time example:
TRUE / FALSE (Boolean) "4" + "8" = 12
String (Unicode String) 4 & 8 = "48"

Pay attention to undesired conversions

Data types represent how values are stored by the DAX storage engine

7
Data Blogs Follow Tajamul Khan

DAX OPERATORS

ARITHMETIC LOGICAL COMPARISON


+ : Add && : AND = : Equals
- : Subtract || : OR <> : Not Equals
* : Multiply NOT() : Negate > : Greater
/ : Divide IF() : Conditional < : Lesser
^ : Power AND() : Multi-AND >= : Greater/Equals
% : Modulus OR() : Multi-OR <= : Lesser/Equals

8
Data Blogs Follow Tajamul Khan

VERTIPAQ
VertiPaq uses a columnar data structure , which stores data as individual columns
(rather than rows or full tables) to quickly and efficiently evaluate DAX queries
ID PRODUCT AMOUNT ID PRODUCT AMOUNT
1 Oats 20 1 Oats 20
2 Biscuit 40 2 Biscuit 40
3 Milk 100 3 Milk 100

Encoding is used to reduce the amount of memory needed to evaluate a DAX


VALUE ENCODING
Mathematical process used to reduce number of bits needed to store integer values
HASH ENCODING
Identifies the distinct string values and creates a new table with indexes
RUN LENGTH ENCODING
Reduces the size of a dataset by identifying repeated values found in adjacent rows

9
Data Blogs Follow Tajamul Khan

CALCULATED COLUMNS
Allow you to add new, formula based columns to tables
Values are calculated based on information from each row of a table (has row
context)
Appends static values to each row in a table and stores them in the model ( which
increases file size).
Recalculate on data source refresh or when changes are made to component
columns
Primarily used as slicers or filters

Target = IF( Table[Sales] > 100, “Met”, “Not Met”)

10
Data Blogs Follow Tajamul Khan

MEASURES
Values are calculated based on information from any filters in the report (has
filter context
Does not create new data in the tables themselves
Recalculate in response to any change to filters within the report
Almost always used within the values field of a visual

Target = IF( Table[Sales] > 100, “Met”, “Not Met”)

Measure can’t be called a calculated measure, just call them measure!


11
Data Blogs Follow Tajamul Khan

MEASURES VS CALCULATED COLUMNS


Values are calculated based on information Values are calculated based on
from any filters in the report (has filter information from each row of a table
context) (has row context)
Does not create new data in the tables Appends static values to each row in a
themselves doesn’t increase file size table and stores them in the model (
which increases file size
Recalculate in response to any change to Recalculate on data source refresh or
filters within the report when changes are made to component
columns
Almost always used within the values field Primarily used as rows , columns , slicers
of a visual or filters

12
Data Blogs Follow Tajamul Khan

EVALUATION CONTEXT
Evaluation contexts are the pillars of DAX i.e., Filter and Row
Row Context : Iterates rows
Filter Context : Filters tables

ROW CONTEXT FILTER CONTEXT

Evaluates expressions row by row in


Definition Filters data based on slicers, filters, or conditions.
calculated columns.

Functions like RELATED() or EARLIER() work with Functions like CALCULATE() and FILTER() use Filter
Example
Row Context. Context.

Key Use Applied to calculated columns in DAX. Applied to measures and aggregation in DAX.

13
Data Blogs Follow Tajamul Khan

FILTER CONTEXT
Filter context filters the tables in your data model
DAX creates filter context when dimensions are added to rows , columns , slicers & filters
CALCULATE can be used to systematically create or modify existing filter context
Filter context always travels (propagates) from the ONE side to the MANY side of a
table relationship

ID COUNTRY AMOUNT
1 India 20

India 2 India 40
3 US 100
Total 60

14
Data Blogs Follow Tajamul Khan

ROW CONTEXT
Row context iterates through the rows in a table
DAX creates row context when you add calculated columns to your data model
Iterator functions (SUMX, RANKX, etc.) use row context to evaluate row level
calculations
Row context doesn't automatically propagate through table relationships (need
to use RELATED or RELATEDTABLE functions)

ID PRODUCTS AMOUNT SUMX (PRODUCTS, AMOUNT)


1 3 20 60
2 4 40 160
3 5 100 500

15
GOOD PRACTICES
Data Blogs Follow Tajamul Khan

NAMING CONVENTIONS
Measures should not belong to a table
• Avoid table name
• [Margin%] instead of Sales[Margin%]
• Should be Easier to move to another table
• Should be Easier to identify as a measure

Use this syntax when to reference:

Columns → Table[Column]
Measures → [Measure]

16
Data Blogs Follow Tajamul Khan

EVALUATION ORDER
is the process by which DAX evaluates the parameters in a function

NON NESTED
IF( Test, True, False )
1 2 3
NON NESTED
SUMX
FILTER(
FILTER ( ‘Table’ 1 = Inner Most Filter
RELATED ( ‘Table’[Column], 2
RELATED( ‘Table’[Column]), 3 = Outer
‘Table’[Column]),

17
Data Blogs Follow Tajamul Khan

DAX SHORTCUTS
ACTION KEYBOARD SHORTCUT

Insert Line Below Shift + Enter

Insert Line Above Shift + Enter

Select Current Line Control + L

Cut Current Line Control + X

Duplicate Current Row Shift + Alt + Up/Down

Go to Line Control + G

Enlarge Code Type Control + Mouse Scroll

18
Data Blogs Follow Tajamul Khan

COMMENT YOUR CODE


Comments can help other users interpret your code, and can be particularly
helpful for complex queries with multiple lines, nested functions, etc.

Single line Comment = -- or //


Multi line Comment = /* ..... */

Bad comment
Total Sales = SUM(Sales[SalesAmount]) --Sum the sales amount

Good comment
Total Sales = SUM(Sales[SalesAmount]) --Calculate total sales amount

19
Data Blogs Follow Tajamul Khan

ERROR HANDLING
Error handling functions can be used to help identify missing data, and can be
particularly useful for quality assurance and testing

IFERROR()
Returns a value if first expression is an error and the
value of the expression itself otherwise
IFERROR(DIVIDE([Numerator], [Denominator]), 0)

ISBLANK()
Checks to see if a value is blank, returns True or False

IF(ISBLANK([Sales]), 0, [Sales])

20
Data Blogs Follow Tajamul Khan

VARIABLES
Very useful to avoid repeating subexpressions in your DAX code.
Variables can be a helpful tool for testing or debugging your DAX code

Debug Complex Measure =


VAR Sales_Amount =
SUM(Sales[SalesAmount])
VAR Cost_Amount = SUM(Sales[Cost])
VAR Profit = SalesAmount -
CostAmount
RETURN
Profit

21
SCALAR FUNCTIONS
Data Blogs Follow Tajamul Khan

COMMON SCALAR FUNCTIONS


function that operates on a single value and returns a single value as a result.

AGGREGATE INFORMATION

ROUND LOGICAL

22
Data Blogs Follow Tajamul Khan

AGGREGATE FUNCTIONS
Functions that can be used to dynamically aggregate values within a column

23
Data Blogs Follow Tajamul Khan

ITERATOR FUNCTIONS
Iterate over the table and evaluate the expression for each row

In reality, SUM is nothing but syntax sugar for SUMX


24
Data Blogs Follow Tajamul Khan

ROUND FUNCTIONS
Functions that can be used to round values to different levels of precision

25
Data Blogs Follow Tajamul Khan

INFORMATION FUNCTIONS
Functions that can be used to analyze the data type or output of an expression

26
Data Blogs Follow Tajamul Khan

LOGICAL FUNCTIONS
Functions for returning information about values in a conditional expression

27
CALCULATE
Data Blogs Follow Tajamul Khan

CALCULATE
It is one of the most powerful and versatile functions. It allows you to modify the
existing filter context of a calculation, enabling you to perform complex
calculations and aggregations.

CALCULATE(<expression>, <filter1>, <filter2>, ...)

Expression example: Filters example


[Sales] Table[Category] = “Arch”
[Orders] Table[Year] = 2025

28
Data Blogs Follow Tajamul Khan

PILLARS OF CALCULATE FUNCTION


EXPANDED TABLES
An expanded table consists of the base table (which is visible to the user), along
with columns from any related table connected via a 1-to-1 or many-to-1
relationship

CONTEXT TRANSITION
Context Transition is the process of turning row context into filter context
By default, calculated columns understand row context but not filter context
To create filter context at the row-level, you can use CALCULATE

29
Data Blogs Follow Tajamul Khan

EVALUATION ORDER
CALCULATE(
3[Quantity],
2 Table[ID] = 4
1 ALL(Table) # All Modifier is evaluated first

MODIFIERS
Modifiers are used to alter the way CALCULATE creates filter context, and are
added as filter arguments within a CALCULATE function
ALL
ALLSELECTED
ALLEXCEPT
KEEPFILTERS
Calculate Modifiers Only
REMOVEFILTERS

30
TABLE FUNCTIONS
Data Blogs Follow Tajamul Khan

COMMON TABLE/FILTER FUNCTIONS

FILTER DATA ADD DATA CREATE DATA


ALL SUMMARIZE ROW
FILTER ADDCOLUMNS DATATABLE
DISTINCT SELECTEDCOLUMNS GENERATESERIES
VALUES {} TABLE COSNTRUCTOR
ALLEXCEPT
ALLSELECTED

31
Data Blogs Follow Tajamul Khan

ALL FUNCTION
Returns all the rows in a table, or all the values in a column, ignoring any filters
ALL is both a table filter and a CALCULATE modifier
Removes initial filter context IGNORES
Does not accept table expressions FILTERS
(only physical table references)
Returns Table

CALCULATE(SUM(Sales[Amount]), ALL(Sales))

Calculate Amount while Removing all filters from Sales Tables

32
Data Blogs Follow Tajamul Khan

FILTER FUNCTION
Returns a filtered table, based on one or more filter expressions
FILTER is both a table function and an iterator
FILTER TABLE
Often used to reduce the number of rows to scan
Returns Table

CALCULATE(SUM(Sales[Amount]),
FILTER(Sales, Sales[Amount] > 1000))

Filter can be used in as a Table function and in calculate as well

33
Data Blogs Follow Tajamul Khan

DISTINCT
NumOfProducts =
Returns the unique values of a column COUNTROWS ( DISTINCT(
only the ones visible in the current filter context. Product[ProductCode]))

VALUES
Returns the unique values of a column, NumOfProducts =
only the ones visible in the current filter context, COUNTROWS ( VALUES(
including the additional blank row if it is visible Product[ProductCode]))
in the filter context.

Use DISTINCT to create new dimension table by extracting unique values from fields
in data table!
34
Data Blogs Follow Tajamul Khan

DISTINCT VS VALUES VS ALL

COUNTRY COUNT ALL COUNT DISTINCT COUNT VALUES


India 4 1 1
China 4 1 1
US 4 1 1
Blank 4 1

VALUES will always consider the blank rows but DISTINCT will not
35
Data Blogs Follow Tajamul Khan

SELECTEDVALUE
SELECTEDVALUE is a convenient function that simplifies retrieving the value of a
column, when only one value is visible.

SELECTEDVALUE (
'Product Category'[Category],
"Multiple values"
)
Equivalent to:
IF ( HASONEVALUE ( 'Product
Category'[Category] ), VALUES (
'Product Category'[Category] ),
"Multiple values" )

36
Data Blogs Follow Tajamul Khan

ALL SELECTED
ALLSELECTED() returns all rows in a table or values in a column, ignoring inner filters
i.e., specified in the visual but respecting other existing filter context.

COUNTRY COUNTRY SALES ALL SALES ALL SELECTED ALL EXCEPT


India India $1M $8M $6M $1M
China
US China $2M $8M $6M $2M
Germany
US $3M $8M $6M $3M
Canada

ALL: Ignores all filters ALLSELECTED: Shows ALLEXCEPT: Retains the


and always totals to the sum of selected filter for the specific
final sum i.e., $8M. countries only i.e., $6M country & shows its sales.

37
Data Blogs Follow Tajamul Khan

ALL EXCEPT
The ALLEXCEPT function in DAX is used to remove all context filters in a table except
for the filters specified in the function arguments.

COUNTRY COUNTRY SALES ALL SALES ALL SELECTED ALL EXCEPT


India India $1M $8M $6M $1M
China
US China $2M $8M $6M $2M
Germany
US $3M $8M $6M $3M
Canada

ALL: Ignores all filters ALLSELECTED: Shows ALLEXCEPT: Retains the


and always totals to the sum of selected filter for the specific
final sum i.e., $8M. countries only i.e., $6M country & shows its sales.

38
Data Blogs Follow Tajamul Khan

ADD DATA FUNCTIONS


Functions used to specify or add columns based on existing data in the model

39
Data Blogs Follow Tajamul Khan

CREATE DATA FUNCTIONS


Functions used to specify or add columns based on existing data in the model

40
TABLE JOINS
Data Blogs Follow Tajamul Khan

41
RELATION FUNCTIONS
Data Blogs Follow Tajamul Khan

TERMINOLOGY
PHYSICAL TABLE VS VIRTUAL TABLE
Physical relationships are manually created, and visible in your data model
Virtual relationships are temporary, and defined using DAX expressions

PHYSICAL RELATION VS VIRTUAL RELATION


There are two key types of table relationships: PHYSICAL and VIRTUAL
Physical relationships are manually created, and visible in your data model
e.g., using data modelling
Virtual relationships are temporary, and defined using DAX expressions
e.g., using Treatas

42
Data Blogs Follow Tajamul Khan

RELATIONSHIP FUNCTIONS

43
TIME INTELLIGENCE
Data Blogs Follow Tajamul Khan

DATE TABLE
Date Table is very important for Time Intelligence

If you import or create your own date table, it must meet


these requirements:
Must contain all days for all years represented in your
fact tables
Must have at least one field set as a Date or DateTime
datatype
Cannot contain duplicate dates or datetime values
If using a time component within a date column, all
times must be identical (i.e. 12:00)
Should be marked as a date table (not required but a
best practice)

44
Data Blogs Follow Tajamul Khan

BUILDING RESUABLE DATE TABLE


DateTable =
ADDCOLUMNS (
CALENDAR (DATE(2020, 1, 1), DATE(2030, 12, 31)),
"Year", YEAR([Date]),
"Month", FORMAT([Date], "MMMM"),
"Month Number", MONTH([Date]),
"Quarter", "Q" & QUARTER([Date]),
"Weekday", FORMAT([Date], "dddd"),
"Weekday Number", WEEKDAY([Date], 2), -- where 1 = Sunday, 2 = Monday
"Is Weekend", IF(WEEKDAY([Date], 2) > 5, TRUE(), FALSE()),
"Is Holiday", FALSE()

45
Data Blogs Follow Tajamul Khan

CALENDAR
Returns a table with one column of all dates between start and end date

CALENDAR(StartDate, EndDate)

MIN of Date or MAX of Date or


can be assigned can be assigned
manually manually

46
Data Blogs Follow Tajamul Khan

CALENDARAUTO()
Returns a table with one column of dates based on a fiscal year end month. The
Range of dates is calculated automatically based on data in the model.
Calendarauto(6) means it starts from 01/07

CALENDARAUTO(FiscalYearEndMonth)

Integer Ranging from 1-12 representing


last month of fiscal year

47
Data Blogs Follow Tajamul Khan

DATE FORMATTING
Used to specify date/time formatting. Common examples include:

48
Data Blogs Follow Tajamul Khan

TIME INTELLIGENCE FUNCTIONS


Time Intelligence functions allow you to define and compare custom time periods

PERFORMANCE PERIOD SHIFT RUNNING TOTAL


calculate performance till date performance between periods calculate moving averages

DATESYTD SAMEPERIODLASTYEAR DATESINPERIOD


DATESQTD DATEADD
DATESMTD PARALLELPERIOD
PREVIOUSYEAR
(YEAR/QUARTER/MONTH)
NEXTYEAR
(YEAR/QUARTER/MONTH)

49
Data Blogs Follow Tajamul Khan

PERFORMANCE TILL DATE FUNCTIONS


Functions commonly used to calculate performance through the current date

50
Data Blogs Follow Tajamul Khan

TIME PERIOD SHIFT FUNCTIONS


Functions commonly used to compare performance between specific periods

51
Data Blogs Follow Tajamul Khan

RUNNING TOTAL FUNCTIONS


Functions commonly used to calculate running totals or moving averages

52
PERFORMANCE TUNING
Data Blogs Follow Tajamul Khan

PERFORMANCE ANALYZER
Power BI’s Performance Analyzer can help us troubleshoot issues, measure load
times for visuals/DAX queries, and optimize your code

Power BI Desktop’s Performance Analyzer records user actions (like Excel’s macro
recorder), and tracks the load time (in milliseconds) for each step in the process:

DAX Query: Time to fetch data from model.


Visual Display: Time to render the visual.
Other: Time for metadata, interactions, or
external tasks.

53
Data Blogs Follow Tajamul Khan

DAX STUDIO
DAX Studio is a free tool that allows you to connect to your Power BI data model to test and
optimize your DAX queries

54
CHEAT SHEET
Data Blogs Follow Tajamul Khan

Math Functions Text Functions


SUMX: SUMX(Sales, CONCATENATE: CONCATENATE(
Sales[Quantity] * 'Table' [Text1],'Table'
Sales[Price]) [Text2])
AVERAGE: AVERAGE ( 'Table' LEFT: LEFT('Table'[Text], 3)
RIGHT: RIGHT('Table' [Text], 5)
[Column ])
LEN: LEN('Table'[Text])
MIN: MIN('Table'[Column]) UPPER: UPPER( 'Table' [Text])
MAX: MAX('Table' [Column]) LOWER: LOWER('Table' [Text])
ROUND: ROUND('Table' TRIM: TRIM('Table'[Text])
[Number], 2) SEARCH: SEARCH("keyword"',
ABS: ABS('Table'[Number]) 'Table'[Text])
EXP: EXP( CONTAINSSTRING: CONTAINSSTRING(
'Table'[Exponent]) 'Table' [Text], "keyword")
LOG: LOG('Table'[Number],10 LEFT: LEFT ('Table' [Text], 3)
RIGHT: RIGHT( 'Table' [Text],3)

55
Data Blogs Follow Tajamul Khan

Date Functions Statistics


TODAY: TODAY() AVERAGEX: AVERAGEX(
NOW: NOW() 'Table', 'Table' [Column])
YEAR: YEAR('Table'[Date]) COUNT: COUNT ( 'Table'
MONTH: MONTH(‘Table' (Column]) |
[Date]) COUNTA: COUNTA (' Table'
DAY: DAY ('Table'[Date]) [Column])
DATEDIFF: DATEDIFF('Table' COUNTAX: COUNTAX( 'Table',
[StartDate], 'Table' 'Table' [Column])
[EndDate], DAY) STDEV.P: STDEV.P( 'Table'
EOMONTH: EOMONTH('Table' [Column])
[Date],0) VAR.P: VAR.P( 'Table'
FORMAT: FORMAT('Table' (Column])
[Date], “yyyy-mm-dd”)

56
Data Blogs Follow Tajamul Khan

Logical Distribution
IF: IF( 'Table'[Column] > NORM. DIST: NORM. DIST
10, "Yes", "No")| (1.96, 0, 1, TRUE)
AND: AND('Table'[Column1] > NORM. INV: NORM. INV (0.95,
5, 'Table'[Column2] < 10) 0, 1)
OR: OR('Table' [Column1] > BINON. DIST: BINOM. DIST(3,
5, 'Table' [Column2] < 10) 10, 0.5, FALSE)
NOT: NOT( 'Table' [Flag]) | POISSON. DIST: POISSON.
SWITCH: SWITCH('Table' DIST(2, 5, FALSE)
[Category],"A",1,"B",2,0)

57
Data Blogs Follow Tajamul Khan

Finance Ranking
PV: PV(0.05, 10, 1000, 0, 0) RANKX: RANKX('Table',
FV: FV(0.05, 10, -100, 0, 0) 'Table' [Sales], , DESC)
MPV: NPV(0.1, CashFlow1, TOPN: TOPN(5, 'Table',
CashFlow2, CashFlow3) 'Table'[Sales], DESC)
IRR: IRR(CashFlows) RANK.EQ: RANK.EQ( 'Table'
TOTALYTD: TOTALYTD(SUM( 'Table' [Sales], 'Table' [Sales],
[Revenue]), 'Date' [Date]) DESC)
CLOSINGBALANCEMONTH:
CLOSINGBALANCEMONTH ( 'Table'
[Revenue],'Date' [Date])
OPENINGBALANCEMONTH:
OPENINGBALANCEMONTH (' Table'
[Revenue],'Date'[Date])

58
Data Blogs Follow Tajamul Khan

Testing Ranking
T.TEST: T. TEST('Group' [Data], TOTALYTD: TOTALYTD(SUM ('Table' [Sales]),
'Group2' [Data], 2, 1) 'Date'[Date])
SAMEPERIODLASTYEAR: CALCULATE(SUM('Table'
ANOVA: ANOVA( 'Table' [Values],
[Sales]).
'Table' [Category]) SAMEPERIODLASTYEAR ('Date' [Date]) )
CHISQ. DIST: CHISQ. DIST (3.84, YTD: CALCULATE (SUM('Table' [Sales]),
2, FALSE) ALL('Date'), 'Date' [Date] <= MAX ( 'Date'
PERCENTILE.INC: PERCENTILE. INC( [Date]) )
QUARTER: QUARTER('Date' [Date])
'Table' [Values], 0.75)
MONTH: MONTH 'Date' [Date])
PERCENTILE.EXC: PERCENTILE. WEEKDAY: WEEKDAY ('Date' [Date], 2)
EXC('Table' [Values], 0.75) CALENDAR: CALENDAR (DATE (2023, 1, 1),
RANK. AVG: RANK. AVG( 'Table' DATE(2023, 12, 31))
[Sales], 'Table' [Category], 1) DATESBETWEEN: DATESBETWEEN( 'Date' [Date],
DATE(2022, 1, 1), DATE (2022, 12, 31))
KEEPFILTERS:
TOTALMTD: TOTALMTD(SUM( 'Table' [Sales]),
KEEPFILTERS(CALCULATE (SUM( 'Date' [Date])
'Table' [Sales]), 'Table' FIRSTDATE: FIRSTDATE ('Date' [Date])
[Category] = "A")) LASTDATE: LASTDATE (('Date' [Date])

59
Data Blogs Follow Tajamul Khan

Table Parent-Child
VALUES: VALUES('Table'[Column ]) PATH: PATH('Table', 'Table'
ALLSELECTED: ALLSELECTED('Table') [ParentID], 'Table' [ID])
ADDCOLUMNS: ADDCOLUMNS ('Table',
PATHITEM: PATHITEM('Table'
"Revenue", 'Table' [Quantity] * 'Table'
[Price]) [Path], 1)
SUMMARIZE: SUMMARIZE ('Table', 'Table' PATHLENGTH: PATHLENGTH('Table'
[Category], "Total Sales", SUM( 'Table' [Path])
[Sales]))
ISFILTERED: IF(ISFILTERED
ROLLUP: ROLLUP('Date', 'Date' [Year],
'Date' [Quarter], 'Date' [Month])
('Table' [Column]), "Filtered",
KEEPFILTERS: KEEPFILTERS "Not Filtered")
(CALCULATETABLE('Table', 'Table'
[Column] > 100))
SELECTCOLUMNS: SELECTCOLUMNS( 'Table',
'Table' [Column1], 'Table' [Column2])
SUMMARIZECOLUMNS: SUMMARIZECOLUMNS(
'Table' [Column1], 'Table' [Column2],
"Total Sales", SUM(‘Table’[Sales]))

60
Data Blogs Follow Tajamul Khan

Advanced Information
PREDICT: PREDICT('Table', 'Table' ISBLANK: IF (ISBLANK
[Value], FILTER('Table', 'Table'
('Table' [Column]), "Blank",
[Date] > DATE(2022, 1, 1)))
COVARIANCE.P: COVARIANCE.P(
"Not Blank")
'Table1' [Values], 'Table2' ISERROR: IF(ISERROR(1/0),
[Values]) "Error", "No Error")
CORRELATION: CORRELATION( TYPEOF: TYPEOF ( 'Table'
'Table1'[Values], 'Table2'[Values])
[Column], INTEGER)
RANK.EQ: RANK.EQ( 'Table' [Sales],
'Table' [Sales], DESC,'Table'
[Category])
PREDICT: PREDICT('Table', 'Table'
[Value], FILTER('Table','Table'
[Date] > DATE(2022, 1, 1)))
COVARIANCE.P: COVARIANCE.P('Table1'
[Values], 'Table2' [Values])

61
Data Blogs Follow Tajamul Khan

Parameter Context
ISBLANK: IF (ISBLANK ('Table' EARLIER: CALCULATE (SUM(
[Column]), "Blank", "Not 'Table' [Sales]), 'Table'
Blank") [Date] = EARLIER ('Table'
ISERROR: IF(ISERROR(1/0), (Date]) - 1)
"Error", "No Error") FILTERS: FILTERS( 'Table'
TYPEOF: TYPEOF ( 'Table' [Category])
[Column], INTEGER) USERELATIONSHIP:
USERELATIONSHIP(' Table1'
[Column], 'Table2'
[Column])

62
FREE
DATA
RESOURCES
FREE PROJECTS
FREE FREE FREE
MACHINE EDA STATISTICS
LEARNING PROJECTS PROJECTS
PROJECTS

Download projects for your portfolio!


55
FREE BOOKS
Statistics EDA SQL Excel

Download your copy now!


54
FREE RESOURCES

Notes & Tips Free Blogs Free Projects

Follow to stay updated!


54
Follow for more!

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy