DAX FUNCTIONS
Raj Kishore Agrawal
Data Analyst | SQL, Python, Power BI | Open to Data Analytics Opportunities
Aggregation Functions
1. SUM: Calculates the total of a column.
2. SUMX: Calculates the sum of an expression evaluated for each row in a table.
3. AVERAGE: Calculates the average of a column.
4. AVERAGEX: Averages an expression evaluated for each row in a table.
5. COUNT: Counts the number of non-blank values in a column.
6. COUNTX: Counts non-blank results of an expression in a table.
7. COUNTBLANK: Returns the count of blank cells in a column.
8. MAX: Returns the largest value in a column.
9. MAXX: Returns the largest value in an expression evaluated for each row.
10. MIN: Returns the smallest value in a column.
11. MINX: Returns the smallest value in an expression for each row.
12. PRODUCT: Multiplies all numbers in a column.
13. PRODUCTX: Multiplies all numbers in an expression for each row in a table.
14. STDEV: Estimates standard deviation of a population sample in a column.
15. STDEVX: Estimates standard deviation of a population sample based on an expression.
16. STDEVP: Returns the standard deviation for an entire population.
17. STDEVPX: Returns the population standard deviation of an expression.
18. VAR: Estimates variance for a population sample.
19. VARX: Estimates variance for a sample based on an expression.
20. VARP: Returns variance for an entire population.
21. VARPX: Returns variance of a population based on an expression.
Date and Time Functions
1. NOW: Returns the current date and time.
2. TODAY: Returns the current date.
3. UTCNOW: Returns the current date and time in UTC.
4. UTCTODAY: Returns the current date in UTC.
5. DATE: Creates a date from individual year, month, and day values.
6. TIME: Returns a time from individual hour, minute, and second values.
7. YEAR: Returns the year from a date.
8. MONTH: Returns the month from a date.
9. DAY: Returns the day from a date.
10. HOUR: Returns the hour from a time value.
11. MINUTE: Returns the minute from a time value.
12. SECOND: Returns the second from a time value.
13. DATEDIFF: Calculates the difference between two dates in units (days, months, etc.).
14. DATEADD: Returns a date shifted by a given interval (e.g., months, years).
15. EDATE: Returns a date shifted by a specified number of months.
16. EOMONTH: Returns the last day of the month, shifted by a number of months.
Filter Functions
1. ALL: Removes filters from the specified column or table.
2. ALLEXCEPT: Removes filters on all columns except the specified ones.
3. FILTER: Returns a table that contains only rows that meet the criteria.
4. CALCULATETABLE: Evaluates an expression in a modified filter context and returns a table.
5. CALCULATE: Evaluates an expression in a modified filter context.
Logical Functions
1. IF: Returns one value if a condition is true and another if false.
2. IFERROR: Returns a value if an expression results in an error, otherwise returns the result.
3. IFBLANK: Returns an alternate value if an expression returns blank.
4. AND: Checks if all conditions are true.
5. OR: Checks if any condition is true.
6. NOT: Reverses the result of a logical expression.
7. XOR: Returns TRUE if one of the conditions is true, but not both.
Mathematical Functions
1. ABS: Returns the absolute value of a number.
2. CEILING: Rounds a number up to the nearest integer or multiple of significance.
3. FLOOR: Rounds a number down to the nearest integer or multiple of significance.
4. ROUND: Rounds a number to the specified number of digits.
5. INT: Returns the integer part of a number.
6. MOD: Returns the remainder of a division.
7. PI: Returns the value of π (Pi).
8. POWER: Returns the result of a number raised to a power.
9. QUOTIENT: Returns the integer portion of a division.
10. SIGN: Returns the sign of a number (+1, 0, -1).
11. SQRT: Returns the square root of a number.
12. TRUNC: Truncates a number to an integer by removing the fractional part.
String Functions
1. LEN: Returns the number of characters in a string.
2. LOWER: Converts all letters in a text string to lowercase.
3. UPPER: Converts all letters in a text string to uppercase.
4. TRIM: Removes extra spaces from text, leaving only single spaces.
5. CLEAN: Removes non-printable characters from text.
6. CONCATENATE: Joins two or more text strings into one string.
7. REPT: Repeats a text string a specified number of times.
8. SUBSTITUTE: Substitutes existing text with new text in a string.
9. SEARCH: Finds the position of a substring within a string (case-insensitive).
10. FIND: Finds the position of a substring within a string (case-sensitive).
Table Functions
1. ALL: Returns all rows in a table or all values in a column, ignoring filters.
领英推荐
2. ALLEXCEPT: Removes all filters on a table except for one or more specified columns.
3. FILTER: Returns a table with rows that meet the specified condition.
4. CALCULATETABLE: Evaluates an expression in a modified filter context and returns a table.
5. SUMMARIZE: Returns a summary table for the requested columns.
6. GROUPBY: Groups rows in a table based on one or more columns.
7. ROLLUP: Creates subtotals for a column.
8. ROLLUPGROUP: Allows grouping for rollup with finer control.
9. CROSSTABLE: Cross-tabulates the data into a pivot-like structure.
Other Functions
1. BLANK: Returns a blank value.
2. DIVIDE: Performs division and returns alternate results if the denominator is zero.
3. FORMAT: Converts a value to text in a specified format.
4. ISBLANK: Checks if a value is blank.
5. ISERROR: Checks if a value results in an error.
6. ISLOGICAL: Checks if a value is a logical type.
7. ISNUMBER: Checks if a value is a number.
8. ISTEXT: Checks if a value is text.
9. USERELATIONSHIP: Specifies an inactive relationship to use in a calculation.
Time Intelligence Functions
Time intelligence functions are specifically designed to work with date hierarchies in Power BI. They allow you to analyze data over time, calculate trends, and perform time-based calculations.
1. DATEADD: Adds or subtracts a specified interval from a date.
2. DATESBETWEEN: Returns a table of dates within a specified range.
3. DATEADDYEARS: Adds or subtracts a specified number of years from a date.
4. DATEADDMONTHS: Adds or subtracts a specified number of months from a date.
5. DATEADDQUARTER: Adds or subtracts a specified number of quarters from a date.
6. DATEADDWEEK: Adds or subtracts a specified number of weeks from a date.
7. DATEADDDAY: Adds or subtracts a specified number of days from a date.
8. DATESYTD: Returns a table of dates from the beginning of the year to the current date.
9. DATESMTD: Returns a table of dates from the beginning of the month to the current date.
10. DATESQTD: Returns a table of dates from the beginning of the quarter to the current date.
11. DATESWTD: Returns a table of dates from the beginning of the week to the current date.
12. PARALLELPERIOD: Returns a period that is parallel to a specified period in a different year.
13. PREVIOUSYEAR: Returns the previous year from a specified date.
14. PREVIOUSMONTH: Returns the previous month from a specified date.
15. PREVIOUSQUARTER: Returns the previous quarter from a specified date.
16. PREVIOUSWEEK: Returns the previous week from a specified date.
17. NEXTYEAR: Returns the next year from a specified date.
18. NEXTMONTH: Returns the next month from a specified date.
19. NEXTQUARTER: Returns the next quarter from a specified date.
20. NEXTWEEK: Returns the next week from a specified date.
Statistical Functions
1. PERCENTILE.INC: Returns the kth percentile value in a data set.
2. PERCENTILE.EXC: Returns the kth percentile value in a data set, excluding the minimum and maximum values.
3. QUARTILE.INC: Returns the kth quartile value in a data set.
4. QUARTILE.EXC: Returns the kth quartile value in a data set, excluding the minimum and maximum values.
5. MEDIAN: Returns the median value in a data set.
6. MODE.MULT: Returns the most frequent value in a data set, returning multiple values if there are ties.
7. MODE.SNGL: Returns the most frequent value in a data set, returning only the first value if there are ties.
Financial Functions
1. FV: Calculates the future value of an investment.
2. PV: Calculates the present value of an investment.
3. PMT: Calculates the periodic payment for a loan.
4. RATE: Calculates the interest rate for a loan.
5. NPER: Calculates the number of periods for a loan.
6. IRR: Calculates the internal rate of return for an investment.
7. NPV: Calculates the net present value of an investment.
Expanded Explanation of DAX Functions with Examples (Continued)
Information Functions
1. USERNAME: Returns the name of the current user.
2. USERPRINCIPALNAME: Returns the user principal name (UPN) of the current user.
3. PATH: Returns the current path in the data model.
4. RELATEDTABLE: Returns a table related to the current table based on a specified relationship.
5. RELATED: Returns a value from a related table based on a specified relationship.
6. HASONEVALUE: Checks if there is exactly one value in a column.
7. EARLIER: Returns the value of an expression from an earlier row context.
8. EARLIERX: Returns the value of an expression from an earlier row context, with a specified filter.
9. LASTNONBLANK: Returns the last non-blank value in a column.
10. FIRSTNONBLANK: Returns the first non-blank value in a column.
Logical Functions (Continued)
11. ANDX: Evaluates an expression for each row in a table and returns TRUE if all expressions are true.
12. ORX: Evaluates an expression for each row in a table and returns TRUE if at least one expression is true.
Table Functions (Continued)
10. ADDCOLUMNS: Adds new columns to a table.
11. GENERATESERIES: Generates a series of numbers or dates.
12. VALUES: Returns a table of unique values from a column.
13. TOPN: Returns the top N rows of a table based on a specified column.
14. BOTTOMN: Returns the bottom N rows of a table based on a specified column.
15. RANKX: Ranks rows in a table based on an expression.