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

We've captured the moments from FabCon & SQLCon that everyone is talking about, and we are bringing them to the community, live and on-demand. Starts on April 14th. Register now

Reply
Zosy
Helper II
Helper II

Measure with MINX and MAXX date of order stages

Hi,
I would like to know how long in average it takes for an order to finalize.

I don't want to create a new table, I need it to be a measure. I tried to calculate the number of hours it takes for an order to complete, but I get the error "The value for 'Start' cannot be determined. Either the column doesn't exist, or there is no current row for this column."

Time to Complete Order = 
VAR _ord = SELECTEDVALUE(order[ID])
VAR _tbl = ADDCOLUMNS(
    SUMMARIZE(
        order, order[ID]),
        "Start",
        CALCULATE(MINX(FILTER(order, order[Status] = "New1"),order[Created On])),
        "End",
        CALCULATE(MAXX(FILTER(order, order[Status] = "Complete1"),order[Created On]))
        )
        RETURN
        DATEDIFF([Start],[End], Hour)

 What am I doing wrong? How can I calculate the average time?

1 ACCEPTED SOLUTION
johnt75
Super User
Super User

[Start] and [End] are columns in the _tbl variable. In this instance I think you want to use variables rather than a table, try

Time to complete =
AVERAGEX (
    VALUES ( order[ID] ),
    VAR Start =
        CALCULATE ( MIN ( order[Created On] ), order[Status] = "New1" )
    VAR End =
        CALCULATE ( MAX ( order[Created On] ), order[Status] = "Complete1" )
    RETURN
        DATEDIFF ( Start, End, HOUR )
)

View solution in original post

2 REPLIES 2
UdayPbi
New Member

You can try like this 
example below is your data you have 
table view.PNG

Create a measure like 

hour =
VAR X = MAX(Orders[time])
VAR Y = MIN(Orders[time])
RETURN

DATEDIFF(Y,X,HOUR)

You get the output like below
hours.PNG

johnt75
Super User
Super User

[Start] and [End] are columns in the _tbl variable. In this instance I think you want to use variables rather than a table, try

Time to complete =
AVERAGEX (
    VALUES ( order[ID] ),
    VAR Start =
        CALCULATE ( MIN ( order[Created On] ), order[Status] = "New1" )
    VAR End =
        CALCULATE ( MAX ( order[Created On] ), order[Status] = "Complete1" )
    RETURN
        DATEDIFF ( Start, End, HOUR )
)

Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.