COLLAPSEALL

Updated on

COLLAPSEALL is a DAX function that retrieves a context with removed detail levels along an axis, enabling navigation to the highest level on the axis and acting as the inverse of EXPANDALL.

Syntax

COLLAPSEALL(
   Expression,
   Axis
)
Argument Properties Description
Expression Optional The expression to be evaluated in the new context.
Axis An axis reference.

Return Values

For the version that performs both navigation and calculation, the function returns the value of the expression in the new context after navigating to the highest level. For the version that performs navigation only, the function modifies the evaluation context by navigating to the highest level.

Remarks

  • This function can be used only in visual calculations.
  • The navigation-only versions of the function can be used inside the CALCULATE function.
  • The levels of the hierarchy are determined by all columns in each axis referenced by the axis reference.

Example

Given a table that summarizes the total sales for a hierarchy with levels for total, year, quarter and month, the following DAX calculation fetches the value of [SalesAmount] at the highest level, total.

TotalValue = COLLAPSEALL([SalesAmount], ROWS)

The screenshot below shows the matrix with the visual calculation.

DAX visual calculation

Other functions related to COLLAPSEALL are:

Contribute » | Contributors: Rick de Groot

2023-2024 © BI Gorilla. All rights are reserved. Information from Microsoft docs is property of Microsoft Corp. | Privacy Policy