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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Anonymous
Not applicable

What is the difference between adding or missing FILTER function?

I have a table like this now.

Car IDTask IDType Start timeFinish time
Car A123S14/7/2022 10:00:0014/7/2022 10:00:01
Car A124T14/7/2022 10:00:0114/7/2022 10:01:00
Car A124T14/7/2022 10:00:0214/7/2022 10:01:05
Car A125S14/7/2022 10:01:0714/7/2022 10:01:10
Car A126S14/7/2022 10:01:1314/7/2022 10:01:13
Car B234T14/7/2022 09:02:0014/7/2022 09:02:10
Car B234T14/7/2022 09:01:5914/7/2022 09:02:10
Car B235S14/7/2022 09:02:0614/7/2022 09:02:20
Car B236S14/7/2022 09:02:1914/7/2022 09:02:30

 

I am wondering what is the difference between the following two expressions.

 

Expression 1:

 

vMaxPrevTaskFinish = 

VAR vThisTaskID = CarTasks[Task ID]

return 
    CALCULATE (
        MAX ( CarTasks[Finish time] ),
        ALLEXCEPT ( CarTasks, CarTasks[Car ID] ),
        CarTasks[Task ID] < vThisTaskID
    )

 

Expression 2:

 

_vMaxPrevTaskFinish = 

VAR vThisTaskID = CarTasks[Task ID]

return 
    CALCULATE (
        MAX ( CarTasks[Finish time] ),
        ALLEXCEPT ( CarTasks, CarTasks[Car ID] ),
        FILTER(CarTasks,CarTasks[Task ID] < vThisTaskID)
    )

 

 

Result:

hyman9090_0-1668503621794.png

Leading to different results.

 

The only difference is whether putting a FILTER function onto the "Task ID". In my mind, they are just doing the same thing as both of them are to "filter" something by passing a condition statement to the CALCULATE function.

 

Can someone explain to me what is the difference between them?

 

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@Anonymous , Refer this

http://dataap.org/blog/2019/04/22/difference-between-calculate-with-and-without-filter-expression/

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

View solution in original post

1 REPLY 1
amitchandak
Super User
Super User

@Anonymous , Refer this

http://dataap.org/blog/2019/04/22/difference-between-calculate-with-and-without-filter-expression/

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.