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

Get certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now

Reply
Anthony_Bell
New Member

Identify penultimate value from a tale based on final event string & date

I have a table ('M Jobs') with job reference numbers ([DeptJobNumber]), Job Events ([JobEventDescription]) and Event Times ([JobEventDateTime] which holds the lifecycles of jobs identified by Events and their timestamps.

 

I also have a list of specific event strings, which I need to use to identify the last occurance of each of these events prior to the job being completed (the "Practically Complete" event).

 

For Example, a job starts it's life once it has been "ENTERED" and is being measured until it hits the "PRACTICALLY COMPLETE" event.

I need to pull the last occurance of a listed event prior to the job being completed.

 

In the example below, we can see that the last listed event prior to the job being "Practically Complete" (10/01/2020 16:24:59) was "Gas No Access NTI" (10/01/2020 15:55:38).

 

I would therefore need to pull this event and time along with the job number, start date and completion date.

 

I have attempted to do this by creating a summarised table but I am still not getting the correct results (see below). I have attempted to use || to define the specific strings but the query fails when trying to convert the string to a boolean.

 

Please, can someone help me out with this as I'm having a nightmare!!  

 

Summary Table

Summary Table.PNG

 

Specific Events List

Measured Events.png

 

Jobs & Events Table

Job Lifecycle.PNG

0 REPLIES 0

Helpful resources

Announcements
November Carousel

Fabric Community Update - November 2024

Find out what's new and trending in the Fabric Community.

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.

Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

Check out the November 2024 Power BI update to learn about new features.