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
tmaki828
Regular Visitor

Duration

I'm looking for a way to calculate the number of days between when a Service Order status is "2-RECEIVED" to "5-QUOTED".  We are looking to report the average it takes orders to go from Received to Quote.  Please note that there could be multiple Service Orders records for one Service Order.

 

Example:  How long did it take SRVO-006460 to go from Received to Quote.  Our SLA = 7 days.

 Sample Data.PNG

 

1 ACCEPTED SOLUTION
v-shex-msft
Community Support
Community Support

HI @tmaki828,

 

You can use following measure to calculate datediff based on current 'document no' and 'before' 'after' fields tag:

Measure =
VAR currNo =
    SELECTEDVALUE ( Table[Document No_] )
VAR list =
    CALCULATETABLE (
        VALUES ( Table[Change Date] ),
        FILTER (
            ALLSELECTED ( Table ),
            [Document No_] = currNo
                && [Before] = "2-RECEIVED"
                && [After] = "5-QUOTED"
        )
    )
RETURN
    DATEDIFF ( MINX ( list, [Change Date] ), MAXX ( list, [Change Date] ), DAY )

 

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

View solution in original post

2 REPLIES 2
v-shex-msft
Community Support
Community Support

HI @tmaki828,

 

You can use following measure to calculate datediff based on current 'document no' and 'before' 'after' fields tag:

Measure =
VAR currNo =
    SELECTEDVALUE ( Table[Document No_] )
VAR list =
    CALCULATETABLE (
        VALUES ( Table[Change Date] ),
        FILTER (
            ALLSELECTED ( Table ),
            [Document No_] = currNo
                && [Before] = "2-RECEIVED"
                && [After] = "5-QUOTED"
        )
    )
RETURN
    DATEDIFF ( MINX ( list, [Change Date] ), MAXX ( list, [Change Date] ), DAY )

 

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.
AlB
Super User
Super User

Hi @tmaki828

Is it not 10 days in the example shown?

Please paste some text format data tha can be readily copied on top of the screen capture. 

Is what you show the full table you're working with (I mean all fields)?

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.