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."

That has done the job @mdevaney , thank you.

Helpful resources

Announcements
Power Apps News & Annoucements carousel

Power Apps News & Announcements

Keep up to date with current events and community announcements in the Power Apps community.

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Top Kudoed Authors
Users online (5,569)