Dax Functions
1) All() Function: Returns all the rows in a table, or all the values in a column, ignoring any filters that might have been applied. This function is useful for clearing filters and creating calculations on all the rows in a table. This function is not used by itself, but serves as an intermediate function that can be used to change the set of results over which some other calculation is performed.
a) It is used to ignore filters from one or more table.
b) This function is not used by itself, but serves as an intermediate function.
Ex-1: CALCULATE([Sales], ALL(DimCustomer)) //DimCustomer is a "Dimension Table"
Ex-2: CALCULATE([Sales], ALL(DimCustomer), ALL(DimProduct)) //DimCustomer & DimProduct are "Dimension Table"
c) If you use Fact Table in the ALL function, then it ignores all the filters from the "Dimension Table"
Ex-1: CALCULATE([Sales],ALL(FactInternetSales)) //FactInternetSales is a "Fact Table"
d) Using ALL without Input Parameter: Ignore Everything. Another approach is to use ALL without any input table or parameters, just as ALL(). This will ignore everything, which can be a good option if your calculation’s value comes from multiple tables and you don’t want any filters to effect it.
Ex-1: CALCULATE([Sales],ALL())
2) AllSelected(): Ignores all the filters applied in the current visual or query but do not ignores the filters from the other visuals. All() Function ignores all filters in the current visual/query or from other visuals.
For ex, if you create a table visual where you have product name in the first column and in the next two columns, values coming from the 2 measures (1st is created using ALL() function & 2nd is created using ALLSELECTED() function). You will see that the values in the 2nd & 3rd columns are same (not filtered by the values in the 1st column of the table visual). But you add one slicer and select any value from it, then the values in the 3rd column of the table visual gets updated but not values in the 2nd column of the table visual. This is because ALL() function ignores all filters coming from the current visual or from other visuals whereas ALLSELECTED() function ignores filters coming from the current visual only, not from the other visuals.
Ex-1: CALCULATE([Sales],ALL(FactInternetSales))
Ex-2: CALCULATE([Sales],ALLSELECTED(FactInternetSales))


Comments
Post a Comment