EVALUATEANDLOG DAX Function (Information)
Return the value of the first argument and also log the value in DAX evaluation log.
Syntax
| Parameter | Attributes | Description |
|---|---|---|
| Value |
A scalar or table expression. |
|
| Label | Optional |
When specified, it is included in the Label column of the DAX Evaluation Log event as well as a part of the JSON payload. |
| MaxRows | Optional |
Specify the number of rows to return in case of a table expression. The default value is 10. |
Return values
The value of the first argument, a scalar or a table.
Remarks
The DAX Evaluation Log is a trace event that can be captured by SQL Server Profiler or by the DAX Debug Output tool.
EVALUATEANDLOG returns the same value as its first argument, so you can place it around almost any sub-expression of a DAX expression without changing the result. The function logs the value only in Power BI Desktop. In other environments, EVALUATEANDLOG is a simple passthrough function that returns the first argument.
The log event includes the text of the first argument, the Label text, the columns of the filter context that affect the value (inputs), the output columns, and the data. If the first argument is a table expression, the event contains only the first MaxRows rows (10 if you omit MaxRows), and the event also has the real number of rows of the table. The result of the expression is not limited by MaxRows. If the event is longer than one million characters, DAX truncates it and keeps a valid JSON structure.
If DAX evaluates the first argument many times in one query, it creates a single event that contains the input values and the output values of all the evaluations. In some cases DAX does not execute the function, because of optimizations of the query plan.
Examples
-- EVALUATEANDLOG returns the same value as its first argument.
-- In Power BI Desktop, it also writes the value, with the label,
-- to the DAX Evaluation Log event. In other environments, it only
-- returns the value of the first argument.
DEFINE
MEASURE Sales[Sales Logged] =
EVALUATEANDLOG ( [Sales Amount], "Sales Amount" )
EVALUATE
SUMMARIZECOLUMNS (
'Date'[Calendar Year Number],
"Sales Amount", [Sales Amount],
"Sales Logged", [Sales Logged]
)
ORDER BY 'Date'[Calendar Year Number]
| Calendar Year Number | Sales Amount | Sales Logged |
|---|---|---|
| 2007 | 11309946.121499848 | 11309946.121499848 |
| 2008 | 9927582.988499861 | 9927582.988499861 |
| 2009 | 9353814.867399855 | 9353814.867399855 |
-- With a table expression, MaxRows limits the rows in the log (default 10).
-- The result of the query is not limited: it has all the rows of the table.
EVALUATE
EVALUATEANDLOG (
TOPN ( 20, VALUES ( 'Date'[Date] ), 'Date'[Date], ASC ),
"First dates",
3
)
ORDER BY 'Date'[Date]
| Date |
|---|
| 2005-01-01 |
| 2005-01-02 |
| 2005-01-03 |
| 2005-01-04 |
| 2005-01-05 |
| 2005-01-06 |
| 2005-01-07 |
| 2005-01-08 |
| 2005-01-09 |
| 2005-01-10 |
| 2005-01-11 |
| 2005-01-12 |
| 2005-01-13 |
| 2005-01-14 |
| 2005-01-15 |
| 2005-01-16 |
| 2005-01-17 |
| 2005-01-18 |
| 2005-01-19 |
| 2005-01-20 |
Related articles
Learn more about EVALUATEANDLOG in the following articles:
-
Introducing the DAX EvaluateAndLog function
Describe how to use the DAX EvaluateAndLog function. » Read more
-
Debugging DAX measures in Power BI
This article describes different techniques to debug a DAX measure that returns an incorrect result, with and without external tools. » Read more
Last update: Nov 17, 2026 » Contribute » Show contributors
Contributors: Alberto Ferrari, Marco Russo
Microsoft documentation: https://learn.microsoft.com/dax/evaluateandlog-function-dax