Solved

date of death fact tbl or dimension?

Posted on 2016-08-17
15
85 Views
Last Modified: 2016-08-18
I need to report on date of death.  I think it goes into a fact table since it's something that has happened. But what if the date of death is null? How would I populate it. I don't want a null in fact tbl.   I really don't want to use a dummy date like 9999-12-31. Any suggestions?
0
Comment
Question by:elucero
  • 7
  • 5
  • 2
  • +1
15 Comments
 
LVL 65

Expert Comment

by:Jim Horn
ID: 41760075
NULL would be appropriate here, as by definition it is the absence of a value.

>I think it goes into a fact table since it's something that has happened.
Not necessarily, as fact tables are measurements, of which date of death would be one.

Unless you want DimDeath, but then your Fact would still join on that table...
1
 

Author Comment

by:elucero
ID: 41760089
Yes, ok NULL does make sense, but won't I have problem with NULL value in a cube?
0
 
LVL 45

Expert Comment

by:Kent Olsen
ID: 41760102
It would depend almost entirely on your database design.

If it's a traditional OLTP, date_of_death would probably just be a column it the table that describes people.

In a data warehouse, the structure of the fact table(s) usually resembles the OLTP's transaction table(s).  Depending on the nature of the business the transactions may be split over multiple fact tables.  An insurance company would probably have 2 fact tables in their D/W.  One for policies/premiums and another for claims.  The two tables would have almost nothing in common except the policy ID so separate tables has advantages.

Does your D/W record multiple events for people?  Birth, graduation, marriage, etc.?  If so, a death record in the fact table is appropriate.
1
Optimizing Cloud Backup for Low Bandwidth

With cloud storage prices going down a growing number of SMBs start to use it for backup storage. Unfortunately, business data volume rarely fits the average Internet speed. This article provides an overview of main Internet speed challenges and reveals backup best practices.

 

Author Comment

by:elucero
ID: 41760163
It's healthcare industry.  If death occurred based on specific disease.   I think it goes into fact tbl??
0
 
LVL 48

Expert Comment

by:PortletPaul
ID: 41760219
the date of death is a fact

NULL (or no row) is a fact too (i.e. not dead, or no death recorded)

death as a dimension would not be very helpful as it is a boolean condition (is dead/is not dead)

a time dimension (I assume you have one) would be relevant to the date of death
(e.g. to answer "how many deaths in fiscal year 2014")
1
 
LVL 45

Expert Comment

by:Kent Olsen
ID: 41760228
I can envision a lot of scenarios and the possibility of several fact tables.

How may fact tables are there?  How may of them record people specific events?
1
 
LVL 48

Expert Comment

by:PortletPaul
ID: 41760338
I can envision a lot of scenarios and the possibility of several fact tables.
agreed!
1
 

Author Comment

by:elucero
ID: 41760375
Thanks for the help.  I have one fact so far with case number, bunch of dates including dt of death which will mapped up to datedim.  I'm worried about putting the dt of death in fact because of how analysis services handles NULLS in a cube.  I don't want it to default to a dummy value like '9999-12-31'.
0
 
LVL 45

Expert Comment

by:Kent Olsen
ID: 41760478
If the patient survived, don't put a row into the fact table that marks the date of death.  That would seem to solve the problem.
0
 

Author Comment

by:elucero
ID: 41761026
I would have put the row in the fact if patient survived since other facts in fact table are caseID ,diaganosisdt, submitteddt, deathdt. So I still have the null issue.  Weather they died or survived I would still have values for the rest - caseID ,diaganosisdt, submitteddt.
0
 
LVL 45

Accepted Solution

by:
Kent Olsen earned 500 total points
ID: 41761086
Ah.  So death is a byproduct of another event, not an event unto itself.  (Never thought I'd hear death described that way, but what the heck....)

With that as a backdrop, the choices would seem to be:

1) Accept that an event that doesn't result in death will have a NULL in the date_of_death column.
2) Default the column to a specific non-null value.  (Very bad idea....)
3) Insert another row in the fact table to provide the death details.

So going back to the original problem, if there is a date_of_death column you're going to have to use 1 or 2 above.  It's not a classic star-schema design, but adding a dimension table on the date_of_death column solves your NULL issue as you'll only include rows with a non-null date in the dimension.  One of the byproduct will be that the optimal tests for survived/died will be slightly different as you can test the dimension table for died, but will have to test the fact table (or outer join the died dimension) to test for survived.  Personally, I'd include the NULL values in the dimension but that seems counter to your wants/needs.

Kent
0
 

Author Comment

by:elucero
ID: 41761149
Thanks, so you're suggesting a death dim which would be like this
caseID
DateofDeath

Then I would do an outer join from factCases to deathdim for my schema fact.caseid = deathdim.caseid.  I think this will work than I can avoid the null values.  Why would add the null values in the deathdim? They only need to report deaths not survived.
0
 

Author Comment

by:elucero
ID: 41761156
I'm thinking now that this would be a good junk dimension since I have other yes/no attributes like case closed, died, hospitalized?  So it would be like this

caseid
dateofdeath
death y/n
datehospitalized
hospitalized y/n
dateclosed
caseclosed y/n
0
 
LVL 45

Expert Comment

by:Kent Olsen
ID: 41761265
If there's exactly on row in the fact table with any given caseid value, this can work.  If a case produce multiple rows any counts (or other aggregate function results) that are based on the dimension will be wrong.
1
 

Author Comment

by:elucero
ID: 41761639
Yes, I think will work.  I'm going to go w/junk dimension.  Thanks for your help, Elizabeth
0

Featured Post

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
SQL Query 2 34
sql server query 18 42
SQL Server sunbquery nested in a CASE statement in a SELECT statement 5 17
SQL 2008 R2 problem with DB 9 18
For both online and offline retail, the cross-channel business is the most recent pattern in the B2C trade space.
When table data gets too large to manage or queries take too long to execute the solution is often to buy bigger hardware or assign more CPUs and memory resources to the machine to solve the problem. However, the best, cheapest and most effective so…
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
Viewers will learn how to use the INSERT statement to insert data into their tables. It will also introduce the NULL statement, to show them what happens when no value is giving for any given column.

820 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question