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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
jwi1
Post Patron
Post Patron

Calculate timeline period

Hi all,

I have a question abour a timeline calculation based on below table.

If the POSITION and the CTR_NR is the same and the TYPE is WAITING ESTIMATE or UNDER REPAIR, I want to calculate the time frame untill the next TIME_STAMP.

For example:

MNBU3337892 is on position WP4.19.

The TIME_STAMP of WAITING ESTIMATE is 26-10-2020 07:00.

The next timestamp after WAITING ESTIMATE is REPAIR COMPLETE on 26-10-2020 09:00

So, the outcome of the calculation is 2 hours.

I hope someone can help me with this!

John

 

positionctr_nrtypetime_stamptime_period (hrs)
WP4.19MNBU3447892Waiting Estimate26-10-2020 07:002
WP4.19MNBU3447892Repair Complete26-10-2020 09:00 
WP4.19SUDU8068773Waiting Estimate26-10-2020 22:006
WP4.19SUDU8068773Awaiting Authorisation27-10-2020 04:00 
WP4.19HLCU9852359Under Repair29-10-2020 11:003
WP4.19HLCU9852359Repair Complete29-10-2020 14:00 
2 ACCEPTED SOLUTIONS
TomMartens
Super User
Super User

Hey @jwi1 ,

 

I'm wondering if there is given order of types. Let's say

1. Waiting Estimate

2. Under Repair

3. ...

 

Regards,

Tom



Did I answer your question? Mark my post as a solution, this will help others!

Proud to be a Super User!
I accept Kudos 😉
Hamburg, Germany

View solution in original post

ryan_mayu
Super User
Super User

@jwi1 

you can try to create a column

Column = 
VAR _time=minx(FILTER('Table','Table'[ctr_nr]=EARLIER('Table'[ctr_nr])&&'Table'[time_stamp]>EARLIER('Table'[time_stamp])),'Table'[time_stamp])
return if('Table'[type]="Waiting Estimate"||'Table'[type]="Under Repair",DATEDIFF('Table'[time_stamp],_time,HOUR),BLANK())

1.PNG





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




View solution in original post

6 REPLIES 6
ryan_mayu
Super User
Super User

@jwi1 

you can try to create a column

Column = 
VAR _time=minx(FILTER('Table','Table'[ctr_nr]=EARLIER('Table'[ctr_nr])&&'Table'[time_stamp]>EARLIER('Table'[time_stamp])),'Table'[time_stamp])
return if('Table'[type]="Waiting Estimate"||'Table'[type]="Under Repair",DATEDIFF('Table'[time_stamp],_time,HOUR),BLANK())

1.PNG





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




TomMartens
Super User
Super User

Hey @jwi1 ,

 

I'm wondering if there is given order of types. Let's say

1. Waiting Estimate

2. Under Repair

3. ...

 

Regards,

Tom



Did I answer your question? Mark my post as a solution, this will help others!

Proud to be a Super User!
I accept Kudos 😉
Hamburg, Germany

@TomMartens  good day,

 

There is indeed a given order:

 

Waiting Estimate can result in either repair complete or waiting estimate.

 

Under repair can result in repair complete

 

Thanks,

 

John

 

Hey @jwi1 ,

 

wondering how "Awaiting authorization" fits into this?

Is there a typo or can there be more "Waiting estimates" before it becomes "Repair complete".

 

Regards,

Tom 



Did I answer your question? Mark my post as a solution, this will help others!

Proud to be a Super User!
I accept Kudos 😉
Hamburg, Germany

Hi @TomMartens ,

 

Sorry, typo error....😅

Please read:

Waiting Estimate can result in either Repair Complete or Awaiting Authorisation.

Under repair can result in Repair Complete

 

John

Hi @jwi1 

You could try to add a new column with the following DAX code:

Hours =
IF (
    'Table'[type] IN { "Waiting Estimate", "Under Repair" },
    DATEDIFF (
        'Table'[time_stamp],
        MINX (
            FILTER (
                'Table',
                'Table'[position] = EARLIER ( 'Table'[position] )
                    && 'Table'[ctr_nr] = EARLIER ( 'Table'[ctr_nr] )
                    && 'Table'[time_stamp] > EARLIER ( 'Table'[time_stamp] )
            ),
            'Table'[time_stamp]
        ),
        HOUR
    ),
    BLANK ()
)

10293.jpg

Best Regards,

Community Support Team _ Jing Zhang

If this post helps, please consider Accept it as the solution to help other members find it.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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