Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8429991
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T05:29:14+00:00 2026-06-10T05:29:14+00:00

I was hoping someone could point me to some best practices regarding when to

  • 0

I was hoping someone could point me to some best practices regarding when to calculate a computed value which is stored in a data warehouse.

Consider the following example,

CREATE TABLE
(
    MyFactID INT NOT NULL IDENTITY(1, 1),
    OrderDimID INT NOT NULL, -- FK To OrderDimension
    StartDate DATETIME NOT NULL,
    CompletedDate DATETIME NULL,
    ElapsedCalendarTimeInMinutes INT NULL,
    ElapsedBusinessTimeInMinutes INT NULL
)

In this example, Elapsed calendar time in minutes would be the time (in minutes) from Start to End date. Then, our business time reflects the working time that was available during those calendar days.

Currently, we are calculating this during ETL and inserting both dates. I’m wondering if this is the correct place to perform this operation.

Some other thoughts were to:

A) Use indexed views by only storing the start and end date in the fact table, then creating a view which calculates the elapsed time in minutes and has a computed column which uses a function to figure out the business days.

B) Use an After trigger to update the elapsed calendar time and business time after an insert occurs which inserts or updates the completed date to a non-null value.

I feel that this should be done in the DB so that if any changes are made to the end date or calculation of the business time, it would reflect. Doing it during ETL seems like it would be prone to problems.

Any thoughts on this are appreciated!

Update: There are at least 6 columns determined in this way. We have business minutes, hours, and days (days are 12 hours for our business); then we have client minutes, hours, and days (determined via lookup table for the client’s working hours); then we have simply calendar minutes, hours, and days (though these are not being stored; only minutes). Since this is a DW, I would have expected all the data to be present and not require calculation. To me, it seems like more work to ensure the ETL is correct and applied everywhere than to create a view overtop of the base data to get the computed information.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T05:29:15+00:00Added an answer on June 10, 2026 at 5:29 am

    The simplest way should be the best solution:

    In your ETL proces (Let us supose that is SSIS but you can extrapolate to other technologies):

    1. create a data flow to copy table from your operational database to datawarehouse backstage.
    2. Update your fact table with a T-Sql task. A merge statement should be enough:

    Merge sample:

    MERGE Target AS T
    USING Source AS S
    ON ( __  matching criteria ___) 
    WHEN NOT MATCHED BY TARGET
        THEN INSERT( OrderDimID, startDate, ... ) VALUES( ... )
    WHEN MATCHED 
        THEN UPDATE SET T.ElapsedCalendarTimeInMinutes = ___some calculations___
    WHEN NOT MATCHED BY SOURCE
        THEN DELETE (?)
    

    This avoid triggers and indexed views.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I was hoping someone could point me in the direction of refactoring some of
I was just hoping that someone could point me to a reference that defines
I was hoping someone could shed some light on a very odd behavior I've
I’m hoping someone could point me in the direction of a library to help
I'm having the most peculiar problem, and I was hoping I someone could point
I was hoping someone could answer some brief questions on windows Azure. I know
I was hoping someone can point out what my problem could be. I am
I was hoping someone could help me with the following script: jQuery(document).ready(function($) { $(.infoBoxBtn
I am hoping someone could enlighten me as to why I am getting the
I was hoping someone could explain what is happening i the following code taken

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.