Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Arnault_
Resolver III
Resolver III

DAX Calculate function with and without FILTER

Hi,

Is there any difference between the two following measures? I get the same results in my report, but I am wondering why I should use FILTER then.

Thanks in advance.

 

Total shipment / sea = 
CALCULATE (
    [Total shipment];
    FILTER ( 'DIM Transport'; 'DIM Transport'[mode_transport_STD] = "SEA" )
)
Total shipment / sea v2 = 
CALCULATE ( [Total shipment]; 'DIM Transport'[mode_transport_STD] = "SEA" )

 

1 ACCEPTED SOLUTION
Arnault_
Resolver III
Resolver III
2 REPLIES 2
Ashish_Mathur
Super User
Super User

Hi,

There are 3 triggers for usage of the FILTER() function

  1. When resolving a conflict - If the same field is placed in a slicer and in the filter argument of the CALCULATE() function, then if a FILTER() function is not used, precedence is given to the filter argument of the CALCULATE() function (completely ignoring the selection made by the end user in the slicer).  If the FILTER() function is used in the filter argument of the CALCULATE() function, then precedence is given to the selection made by the end user in the slicer.
  2. When giving rich filter conditions - Simple filter conditions such as column value > fixed value do not warrant usage of FILTER() function.  Rich filter conditions such as column value > column value or column value > measure or measure > measure require usage of the FILTER() function.
  3. When giving OR conditions - Even though one can specify unlimited filter conditions in the CALCULATE() function, they are all AND conditions by default.  To specify OR conditions, one must use the FILTER() function.  That being said, there is a way to bypass the FILTER() function by using the || symbol to specify OR conditions.

Hope this helps.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
Arnault_
Resolver III
Resolver III

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.