cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
PPSA
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
mdevaney
Super User
Super User

@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
mdevaney
Super User
Super User

@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

That has done the job @mdevaney , thank you.

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Welcome Super Users.jpg

Super User Season 2

Congratulations, the new Super User Season 2 for 2021 has started!

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

Users online (1,515)