Query Calculations

stuartandwil

Board Regular
Joined
Nov 24, 2002
Messages
104
i use two calculations to give me job downtimes, to calculate a job that is still in progress and give me the downtime so far I use

DateDiff("n",[start],Now())

to calculate the downtime of a job that is completed i use

DateDiff("n",[start],[complete])

The above are two seperate queries.

What I want is a report from the query that will give me both calculations for the jobs in one report. So in the list i will get all jobs but the ones not completed will give the downtime up to the time of the report. Is this possible by using 1 query to give me boith results?

Many thanks :confused:
 

Excel Facts

Control Word Wrap
Press Alt+Enter to move to a new row in a cell. Lets you control where the words wrap.
Hav e you though of nexting queries? You know, the source for a query isn't necessarily a table; it could be another query (i.e. "subquery").

You could also build the results together via make table/append table.

But I'm not aware of any way that you can have multiple input recordsources for a report.
 
Upvote 0
Are the 2 calculations really in 2 separate queries, or are they just 2 different calculation fields? You could build a single query with fields like:
JobID, JobDescription, Start, Complete, and then a single calculation field, Downtime:Iif(IsBlank([Complete]),DateDiff("n",[start],Now()) ,DateDiff("n",[start],[complete]) )
Then you have the full downtime calculation in one field and can filter on the presence / absence of a value in the [Complete] field.

Regards
Denis
 
Upvote 0

Forum statistics

Threads
1,221,574
Messages
6,160,602
Members
451,657
Latest member
Ang24

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top