Forum Discussion

tvaishnav's avatar
tvaishnav
Helper IV
4 years ago

How do model data with different granularity?

I have a situation where I want to compare cost and revenue. My revenue number is just an aggregate, however cost has sub categories. How would you model this?

 

I can think of these ways.

 

1) Put revenue in one row and have 0s in all others 

 

ProjectRevenue CostCost Category
Project A1000000500Cat 1
Project A090000Cat 2
Project A08855Cat 3
Project A06000Cat 4

 

2) Make single column for cost and revenue.

 

ProjectTypeValue
Project ARevenue100000
Project ACost Cat 1500
Project ACost Cat 290000
Project ACost Cat 38855
Project ACost Cat 46000

 

3) Create two fact tables one for revenue and another for cost.

 

In general, I have been struggling with this concept of different grains in data for a while. Any pointers on what are the best practices? 

 

 

4 Replies

  • PaulDBrown's avatar
    PaulDBrown
    Community Champion

    I would go for option "3) Create two fact tables one for revenue and another for cost" and have a bridge table for Project and any other fileds common to both tables.

    • tvaishnav's avatar
      tvaishnav
      Helper IV

      Thank you for your response. Do you think I can create this using matrix visual and two fact tables?

       

       

      • PaulDBrown's avatar
        PaulDBrown
        Community Champion

        Sure, but you will need a table with the row structure for the matrix. SImilar to this, but for rows instead of columns:

        Custom Matrix