Quantcast
Channel: Desktop topics
Viewing all articles
Browse latest Browse all 213819

Two types of fact tables in the same visualization

$
0
0

Hi,

I'm trying to solve the following modeling challange. I have one solution in mind, which is a bit ugly,

and would be happy to hear other ideas.

 

The model is for a finanicial instituation. Let's simplify and say it's a bank.

We need to show in one visualization the net money transactions(+11M$ for example), as well as balance at the end of the period(350M$), grouped by days or months.

The money transactions are basically deposits and withdrawlas. If someone deposits 400$ on a specific month and withdraws 100$, that person contributes 300$ to the net money transaction of that month.

The balance, however, cannot be calculated using the transactions because it includes some movement that is not reresented in the transactions table(e.g. interest).

 

Data sources(very simplified) :

1. daily transaction aggregation fact : fact_transaction : user_id, date_id, net_amount

2. daily balance table : fact_balance : user_id, date_id,balance

3. dim_user and dim_date

 

The visualization should show something like that :

Month, net money growth, balance

(month can be replaced by year, day, week, quarter etc.).

 

The two fact tables are very different. fact_transaction is a transaction fact(can be aggregated) while fact_balance is a periodic snapshot and cannot be aggregated. 

 

As I mentioned, I have a solution in mind, but it isn't pretty and I'd like to hear your ideas on how to enable this.

Solutions can be within Power BI desktop or on the database level(I'm the DBA too and can prepare the data in whatever way necessary).

 

Thanks !

 


Viewing all articles
Browse latest Browse all 213819

Trending Articles