Code action DR003
(Readability) Use VALUES instead of SUMMARIZE
Description
When SUMMARIZE
only specifies a single column, and that column belongs to the table specified in the first argument, the code can be more concisely written using VALUES
.
Example
Change:
SUMMARIZE(Sales, Sales[Product Key])
To:
VALUES(Sales[Product Key])
Why is Tabular Editor suggesting this?
The SUMMARIZE
function is a powerful function that can be used to group data and calculate aggregates. However, when you only need to retrieve the distinct values of a single column, the VALUES
function is more concise and easier to read. By using the VALUES
function, the code becomes more readable and the intent of the expression is clearer.