Forum Discussion

StianBWLNG's avatar
StianBWLNG
Frequent Visitor
5 years ago
Solved

How to get a full outer join with relationship?

I have two tables Budget and Actual

Budget:

AccountYearMonthValue
120211100
220211200
320211300

Actual:

AccountYearMonthValue
120211100
220211200
320211300


I want a matrix like this:

Year2021
Accountbudget_valueactual_value
1100 
2200100
3300200
4 300
Total600600

 

I tried creating an ID by stringing Account&Year&Month and then linking those. But I end up with this:

 

How would I go about doing this in PowerBI? In SQL I would do a full outer join and then COALESCE the two different accounts.

But now I do want to keep the two tables separate and use a relationship as they have different granularity in real life so I cannot merge them. (Actuals have a hierarchy level below account that I want to keep)

 

  • Anonymous's avatar
    Anonymous
    5 years ago

    You need to add 2 dimension tables: Dates and Accounts as shown in the screenshot. You have to add a date column too to the Actuals and Budgets table so that you can relate them to the Dates dimension table.

    Then you can display the data in a matrix using the Account column from the Accounts table and the Year column of the Dates table. The result will be as such:

     

2 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    You need to add 2 dimension tables: Dates and Accounts as shown in the screenshot. You have to add a date column too to the Actuals and Budgets table so that you can relate them to the Dates dimension table.

    Then you can display the data in a matrix using the Account column from the Accounts table and the Year column of the Dates table. The result will be as such:

     

  • StianBWLNG's avatar
    StianBWLNG
    Frequent Visitor

    Thanks a lot. I see I need to go for full star modelling then (in my non-minimal version).