We've captured the moments from FabCon & SQLCon that everyone is talking about, and we are bringing them to the community, live and on-demand. Starts on April 14th. Register now
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
| Project | Revenue | Cost | Cost Category |
| Project A | 1000000 | 500 | Cat 1 |
| Project A | 0 | 90000 | Cat 2 |
| Project A | 0 | 8855 | Cat 3 |
| Project A | 0 | 6000 | Cat 4 |
2) Make single column for cost and revenue.
| Project | Type | Value |
| Project A | Revenue | 100000 |
| Project A | Cost Cat 1 | 500 |
| Project A | Cost Cat 2 | 90000 |
| Project A | Cost Cat 3 | 8855 |
| Project A | Cost Cat 4 | 6000 |
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?
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.
Proud to be a Super User!
Paul on Linkedin.
Thank you for your response. Do you think I can create this using matrix visual and two fact tables?
Sure, but you will need a table with the row structure for the matrix. SImilar to this, but for rows instead of columns:
Proud to be a Super User!
Paul on Linkedin.
Have a read of https://www.daxpatterns.com/budget/ by the SQLBI guys, it should give you some ideas about working at different granularities.
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.
Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.
| User | Count |
|---|---|
| 54 | |
| 39 | |
| 33 | |
| 18 | |
| 18 |
| User | Count |
|---|---|
| 67 | |
| 62 | |
| 38 | |
| 34 | |
| 22 |