Ouch, a surprisingly toxic mixture: Query Builder and Column formulas!
Some settings like in Subset

would remove lot of headache.
Besides that: a nice magnifying glass for the nuts and bolts of JMP : )
Which version of JMP? Can you share the steps from the log?
I tested it with JMP 18.2.2 and 19.0, where Lag() gets executed after executing the query, Col Sum() doesn't.
After removing the formulas, everything is fine.
[maybe: did you reference an old data table "untitled" - with formulas?]


names default to here(1);
dt = New Table( "Untitled",
Add Rows( 4 ),
New Column( "Column 1",
Format( "Best", 12 ),
Set Values( [1, 2, 3, 4] )
),
New Column( "Sum[Column 1]",
Formula( Col Sum( :Column 1 ) )
),
New Column( "Lag[Column 1]",
Formula( Lag( :Column 1, 1) )
)
);
dt << run formulas();
wait(0);
queryDT= Expr(New SQL Query(
Connection( "JMP" ),
Select(
Column( "Column 1", "t1" ),
Column( "Sum[Column 1]", "t1" ),
Column( "Lag[Column 1]", "t1" )
),
From( Table( "Untitled", Alias( "t1" ) ) ),
Where(
GT(
Column( "Column 1", "t1" ),
2,
UI( Comparison( Base( "Continuous" ) ) )
)
)
) << Run Foreground);
queryDT;
Column (dt, 2) << delete formula();
Column (dt, 3) << delete formula();
wait(0);
queryDT;
wait(0);
dt << set name("input");