ALL DAX Function (Filter)

Returns all the rows in a table, or all the values in a column, ignoring any filters that might have been applied.

Syntax

ALL ( [<TableNameOrColumnName>] [, <ColumnName> [, <ColumnName> [, … ] ] ] )
Parameter Attributes Description
TableNameOrColumnName Optional

The name of an existing table or column.

ColumnName Optional
Repeatable

A column in the same base table. The column can be specified in optional parameters only when a column is used in the first argument, too.

Return values

Table An entire table or a table with one or more columns.

Remarks

This function removes the corresponding filters from the filter context, just as REMOVEFILTERS does. It does not materialize the resulting table when called directly in a filter argument of CALCULATE or CALCULATETABLE.

ALL can be used as a table expression when it has at least one argument.
ALL without arguments can be used only as a CALCULATE or CALCULATETABLE modifier and removes all the filters from the filter context.

The following remarks are valid using ALL as a table expression:

  • Using a table argument, ALL returns all the rows of the table including any duplicated rows.
  • Using a single column argument, ALL returns all the unique values of the column.
  • Using two or more columns arguments, ALL returns all the unique combinations of values in multiple columns.
  • In every case, ALL includes in the result the additional blank row generated for invalid relationships.
» 4 related articles
» 4 related functions

Examples

The ALL function can be applied to either a table or a set of columns.

ALL ( Customer )

ALL ( Customer[Country], Customer[State] , Customer[City] )
--
--  This query returns all the products, 
--  ignoring the filter on product color
--
EVALUATE
CALCULATETABLE (
    ALL ( 'Product' ),
    'Product'[Color] = "Red"
)
EVALUATE 
CALCULATETABLE (
    ALL ( 'Product'[Color] ),
    'Product'[Color] = "Red"
)
ORDER BY 'Product'[Color]
Color
Azure
Black
Blue
Brown
Gold
Green
Grey
Orange
Pink
Purple
Red
Silver
Silver Grey
Transparent
White
Yellow
EVALUATE
CALCULATETABLE (
    ALL (
        'Product'[Brand],
        'Product'[Color]
    ),
    'Product'[Color] = "Red"
)
ORDER BY
    'Product'[Brand],
    'Product'[Color]

Brand Color
A. Datum Azure
A. Datum Black
Contoso Black
Contoso Blue
The Phone Company Black
The Phone Company Gold
Wide World Importers Black
Wide World Importers Gold
Wide World Importers White
Wide World Importers Yellow
--
--  This query returns all the products,
--  ignoring the filter on product color
--  ALL as a filter modifier is like REMOVEFILTERS
--
EVALUATE
CALCULATETABLE (
    CALCULATETABLE (
        'Product',
        ALL ( 'Product'[Color] )   -- same as REMOVEFILTERS ( 'Product'[Color] )
    ),
    'Product'[Color] = "Red"
)
ORDER BY
    'Product'[Brand],
    'Product'[Color]
--
--  This query returns all the products,
--  removing any filter from the filter context.
--  ALL as a filter modifier is like REMOVEFILTERS.
--
EVALUATE
CALCULATETABLE (
    CALCULATETABLE (
        'Product',
        ALL ( )   -- same as REMOVEFILTERS (  )
    ),
    'Product'[Color] = "Red"
)
ORDER BY
    'Product'[Brand],
    'Product'[Color]
--
--  ALL with a table works on the expanded table, removing filters
--  from any column in the expanded table
--
EVALUATE
CALCULATETABLE (
    {
         ( "Sales Amount ", [Sales Amount] ),
         ( "Sales Amount (ALL Colors)", CALCULATE (
                                            [Sales Amount],
                                            ALL ( 'Product'[Color] )
                                        ) 
         ),
         ( "Sales Amount (ALL Products)", CALCULATE (
                                              [Sales Amount],
                                              ALL ( 'Product' )
                                          ) 
         ),
         ( "Sales Amount (ALL)", CALCULATE (
                                     [Sales Amount],
                                     ALL ()
                                 ) 
         ),
         ( "Sales Amount (ALL Sales)", CALCULATE (
                                           [Sales Amount],
                                           ALL ( Sales )
                                       )
         )
    },
    'Product'[Color] = "Red",
    'Date'[Calendar Year] = "CY 2008"
)

Value1 Value2
Sales Amount 395,277.22
Sales Amount (ALL Colors) 9,927,582.99
Sales Amount (ALL Products) 9,927,582.99
Sales Amount (ALL) 30,591,343.98
Sales Amount (ALL Sales) 30,591,343.98

Related articles

Learn more about ALL in the following articles:

Related functions

Other related functions are:

Last update: Nov 14, 2024   » Contribute   » Show contributors

Contributors: Alberto Ferrari, Marco Russo, Kenneth Barber

Microsoft documentation: https://docs.microsoft.com/en-us/dax/all-function-dax

2018-2024 © SQLBI. All rights are reserved. Information coming from Microsoft documentation is property of Microsoft Corp. » Contact us   » Privacy Policy & Cookies

Context Transition

This function performs a Context Transition if called in a Row Context. Click to read more.

Row Context

This expression is executed in a Row Context. Click to read more.

Iterator

Not recommended

The use of this function is not recommended. See Remarks and Related functions for alternatives.

Not recommended

The use of this parameter is not recommended.

Deprecated

This function is deprecated. Jump to the Alternatives section to see the function to use.

Volatile

A volatile function may return a different result every time you call it, even if you provide the same arguments. Click to read more.

Deprecated

This parameter is deprecated and its use is not recommended.

DirectQuery compatibility

Limitations are placed on DAX expressions allowed in measures and calculated columns.
The state below shows the DirectQuery compatibility of the DAX function.

Contribute

Want to improve the content of ALL? Did you find any issue?
Please, report it us! All submissions will be evaluated for possible updates of the content.


This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.