In simple terms grain is the lowest level till which you could identify the data in a table.
For example: If you have table which holds the stock inventory and table holds:
How does grain impacts the data warehouse:
It is important that while designeing the databse we design till the lowest grain for which we business needs to analyse or report.
With example above, If your Stock inventory table has grain of day you can easily calculate weekly stock but viceversa is not true.
Similarly, grain of related tables(Facts and Dims) should complement each other. For eg if Fact_Stock_Inventory holds data for each hour and Dim_DateTime has a grain of a day, it will generate distorted results.
For example: If you have table which holds the stock inventory and table holds:
- One record for each day of the stock : Than the grain would be one day
- One record for each hour : than the grain of the table would be hour
- One record for each week : than the grain of the week would be week.
How does grain impacts the data warehouse:
It is important that while designeing the databse we design till the lowest grain for which we business needs to analyse or report.
With example above, If your Stock inventory table has grain of day you can easily calculate weekly stock but viceversa is not true.
Similarly, grain of related tables(Facts and Dims) should complement each other. For eg if Fact_Stock_Inventory holds data for each hour and Dim_DateTime has a grain of a day, it will generate distorted results.
No comments:
Post a Comment