IntroductionGetting Stared with Power BIData Sources in Power BIData Modelling in Power BIDAX In Power BIPower BI VisualizationPower Bi Service
Common DAX Functions:
Aggregation Functions:
SUM()
: Sums the values in a column.- Example:
SUM(Sales[Amount])
- Example:
AVERAGE()
: Calculates the average of values in a column.- Example:
AVERAGE(Sales[Amount])
- Example:
COUNT()
,COUNTA()
,COUNTROWS()
: Count the number of rows, values, or non-empty values.MIN()
,MAX()
: Returns the minimum or maximum value of a column.
Logical Functions:
IF()
: Performs a logical test and returns different values based on the result.- Example:
IF(Sales[Amount] > 1000, "High", "Low")
- Example:
AND()
,OR()
,NOT()
: Logical functions for combining conditions.
Date and Time Functions:
TODAY()
: Returns the current date.YEAR()
,MONTH()
,DAY()
: Extract specific parts of a date.DATEDIFF()
: Calculates the difference between two dates.DATEADD()
: Shifts a date by a specified number of periods.
Filter Functions:
FILTER()
: Returns a table that has been filtered according to a specified expression.- Example:
FILTER(Sales, Sales[Amount] > 1000)
- Example:
ALL()
: Removes filters from a table or column.- Example:
ALL(Sales[Product])
removes any filters on the Product column.
- Example:
CALCULATE()
: Modifies the context in which a calculation is performed.- Example:
CALCULATE(SUM(Sales[Amount]), Sales[Region] = "North")
- Example:
Ranking and Windowing Functions:
RANKX()
: Ranks items based on a given expression.- Example:
RANKX(ALL(Sales[Product]), SUM(Sales[Amount]))
- Example:
TOPN()
: Returns the top N rows of a table based on a given expression.
Text Functions:
CONCATENATE()
: Joins two text strings together.LEFT()
,RIGHT()
,MID()
: Extracts specific parts of a string.SEARCH()
,FIND()
: Finds the position of a substring within a string.
Statistical Functions:
STDEV.P()
,STDEV.S()
: Standard deviation calculations.VAR.P()
,VAR.S()
: Variance calculations.
Time Intelligence Functions:
- Predefined time periods: DAX has built-in functions for time-based calculations. Examples:
SAMEPERIODLASTYEAR()
: Compares the current period to the same period in the previous year.PARALLELPERIOD()
: Shifts a date range by a specified number of periods.TOTALYTD()
,TOTALQTD()
,TOTALMTD()
: Total Year-to-Date, Quarter-to-Date, and Month-to-Date calculations.
- Predefined time periods: DAX has built-in functions for time-based calculations. Examples: