cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Resolver II
Resolver II

Add in filter to datediff, last, if statement

Hi all, 
I have the below formula so far, which is giving me the value of how long somebody paused an operation.

DateDiff(
Last(
If(
ThisItem.Operation = "Cutting",
TempCuttingTimeLog,
ThisItem.Operation = "Drilling",
TempDrillingTimeLog,
ThisItem.Operation = "Welding",
TempWeldingTimeLog,
ThisItem.Operation = "Inspection",
TempInspectionTimeLog
)
).Pause,
Now(),
Minutes
)

I need to include a filter into this as there can be multiple jobs in the source list at once and the last value needs to match with the last when its title=thisitem.title.

I've had a few go's at this and think i'm getting the syntax order messed up.

Image below was taken at 12.42, the 60 it is displaying is the "pause time" this is wrong as it's looking at the last pause time, not the last pause time that matches the job number/title

Thanks as always!2020-07-02 12_42_44-.png

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Super User III
Super User III

@PPSA 
Here's my attempt at it...

DateDiff(
    Last(
        If(
            ThisItem.Operation = "Cutting",
            Filter(TempCuttingTimeLog, Title=2),
            ThisItem.Operation = "Drilling",
            Filter(TempDrillingTimeLog, Title=2),
            ThisItem.Operation = "Welding",
            Filter(TempWeldingTimeLog, Title=2),
            ThisItem.Operation = "Inspection",
            Filter(TempInspectionTimeLog, Title=2)
        )
    ).Pause,
    Now(),
    Minutes
)



---
Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

View solution in original post

2 REPLIES 2
Highlighted
Super User III
Super User III

@PPSA 
Here's my attempt at it...

DateDiff(
    Last(
        If(
            ThisItem.Operation = "Cutting",
            Filter(TempCuttingTimeLog, Title=2),
            ThisItem.Operation = "Drilling",
            Filter(TempDrillingTimeLog, Title=2),
            ThisItem.Operation = "Welding",
            Filter(TempWeldingTimeLog, Title=2),
            ThisItem.Operation = "Inspection",
            Filter(TempInspectionTimeLog, Title=2)
        )
    ).Pause,
    Now(),
    Minutes
)



---
Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

View solution in original post

Highlighted

That has done the job @mdevaney , thank you.

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

News & Announcements

Community Blog

Stay up tp date on the latest blogs and activities in the community News & Announcements.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Community Highlights

Community Highlights

Check out the Power Platform Community Highlights

Top Solution Authors
Top Kudoed Authors
Users online (2,641)