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

Try your skills in the Power BI Dataviz World Championship! Round one ends June 26. Join now

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
Fabric Data Days is here Carousel

Fabric Data Days 2026

Don't miss out on Data Days, June 15 through August 7. Learn Fabric, Power BI, SQL, AI and more.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.