Daily DAX : Day 444 LOOKUPWITHTOTALS
Power BI DAX Function: LOOKUPWITHTOTALS
LOOKUPWITHTOTALS is a DAX function introduced in Power BI as part of visual calculations (available since around May 2025). It is designed specifically for use in visual calculations on matrix or table visuals.
Syntax
LOOKUPWITHTOTALS(
<expression>,
<column_reference>, <value>
[, <column_reference>, <value>] ...
)
- <expression>: The measure or expression to evaluate (e.g., a sales amount measure).
- <column_reference>: A column on the visual's axes (rows or columns).
- <value>: The specific value to match in that column.
- Additional pairs of column_reference and value are optional for multiple filters.
How It Works
LOOKUPWITHTOTALS looks up and evaluates the expression in the visual's matrix where the specified columns match the given values. For any columns on the visual not specified in the function, it automatically uses the grand total (i.e., ignores filters on those columns).
This differs from the related LOOKUP function, which respects the current row/column context for unspecified columns.
Use Cases
- Retrieving a higher-level total (e.g., yearly total) while showing details (e.g., quarterly breakdown).
- Comparing detailed values against a subtotal or grand total without complex measures using CALCULATE and REMOVEFILTERS.
- Creating contributions to parent totals or simple variances in matrix visuals.
Example
Imagine a matrix visual with Fiscal Year and Quarter on rows, and a measure [Sales Amount].
LOOKUP([Sales Amount], [Fiscal Year], "FY2018")
→ Returns sales for the current quarter in FY2018 (respects quarter filter).LOOKUPWITHTOTALS([Sales Amount], [Fiscal Year], "FY2018")
→ Returns the total sales for FY2018 (ignores quarter filter, uses grand total across quarters).
This allows you to add a visual calculation column showing "FY2018 Total" repeated on every quarter row for easy comparison.
Key Benefit
It simplifies writing calculations that reference higher-level aggregates directly on the visual, reducing the need for complex traditional DAX measures.
Note: This function is intended for visual calculations only and works within the context of the visual's matrix.
Comments
Post a Comment