Forum Discussion
Multi Table Pivot - Turning Excel into a Relational DB
- 2 years ago
Hi Anonymous ,
Quick answer: You can only compare measure values from each fact table along with columns from the common dimension tables, not columns from the fact tables.
Extended answer:
Without knowing exactly what you're trying to do when you get your relationship error and what the error says exactly, I can only guess that you're trying to add columns from both your SA_DETAIL and GL_DATA to your pivot at the same time. Regardless of your current relationships, the data model isn't going to be able to accurately match individual rows from these two tables to one another and hence you're getting relationship errors.
For example:
Let's say DEALCODE[Project Name] = "A". This filters both the SA_DETAIL and GL_DATA tables accordingly.
For the sake of example, let's assume that SA_DETAIL[Name] = GL_DATA[Company Name]. This gives you two filtered columns something like this:
SA_DETAIL[Name] = {"Acme Inc", "Acme Inc", "ABC Ltd", "Bubbles Corp"}
GL_DATA[Company Name] = {"Acme Inc", "Coco's", "XYZ Ltd"}
As you can see, just because these tables are related, it doesn't mean that exact row matches can be made between the tables, hence your relationship errors.
What you CAN compare between the two tables is measure values and common dimension table columns. As measures will aggregate all the values in each filtered table into scalar values, these can be compared in the same visual/pivot along with any column(s) from the common dimension tables but, as soon as you add a column from either fact table to the visual/pivot, you'll get your error again.
There's probably a bit more to it than this, but I think this is the principle at play here.
Pete
- 2 years ago
Hi Anonymous ,
If you want to do specific joins between the tables to get the output you want, you can use Power Query in Excel to do this.
Depending on your Excel version, you should be able to open the Power Query Editor either from here:
...or I think in older versions it sits within the "Combine Queries" option just above.
If you're going down the "Excel as a DB" route, Power Query is going to be a key tool to allow transformations on your tables (such as joins, filters, adding/removing columns etc.). It's another learning curve if you've not used it before I'm afraid, but it's incredibly powerful.
Using Power Query + Data Model/Power Pivot + Measures in Excel basically gives you Power BI capabilities, just with slightly less visually-appealing visualisations. Or you could just download Power BI Desktop if powerful and professional data handling and visualisation is something your organisation is aiming towards.
Re: The actual issue - I think I'd need a small amount of anonymised but representative example data from each table that you want to include in your manipulation, and also an example of what you'd want the output to look like. Once I can physically see what you're going for it should be much easier to understand what needs to be done, and how. However, in my experience, many-to-many joins/relationships or Full Outer joins are very rarely the solution.
Pete
Hi Anonymous ,
Quick answer: You can only compare measure values from each fact table along with columns from the common dimension tables, not columns from the fact tables.
Extended answer:
Without knowing exactly what you're trying to do when you get your relationship error and what the error says exactly, I can only guess that you're trying to add columns from both your SA_DETAIL and GL_DATA to your pivot at the same time. Regardless of your current relationships, the data model isn't going to be able to accurately match individual rows from these two tables to one another and hence you're getting relationship errors.
For example:
Let's say DEALCODE[Project Name] = "A". This filters both the SA_DETAIL and GL_DATA tables accordingly.
For the sake of example, let's assume that SA_DETAIL[Name] = GL_DATA[Company Name]. This gives you two filtered columns something like this:
SA_DETAIL[Name] = {"Acme Inc", "Acme Inc", "ABC Ltd", "Bubbles Corp"}
GL_DATA[Company Name] = {"Acme Inc", "Coco's", "XYZ Ltd"}
As you can see, just because these tables are related, it doesn't mean that exact row matches can be made between the tables, hence your relationship errors.
What you CAN compare between the two tables is measure values and common dimension table columns. As measures will aggregate all the values in each filtered table into scalar values, these can be compared in the same visual/pivot along with any column(s) from the common dimension tables but, as soon as you add a column from either fact table to the visual/pivot, you'll get your error again.
There's probably a bit more to it than this, but I think this is the principle at play here.
Pete
BA_PETE -
You are spot on; I do sincerely appreciate your assistance on this. I'm going to have to do some Googling to make sure I understand the PowerQuery Jargon you're using here (Dimension, Measure) but I may get there at some point today.
My background and knowledge is really SQL based, so in those terms I really would just wanting to do
INNER JOIN GL[BILLING CODE] ON DETAIL[DEAL] and
INNER JOIN GL[THIRD PARTY] ON DETAIL[V#]
Unfortunately of course, this is a many to many join, which excel will just NOT ALLOW; hence why I have the Unique ID of V# in ROSTER, and Unique ID of PROJECT in the DEALCODE table as the bridge/link tables between GL and DETAIL
If it helps, my End PIVOT would simply be
V#, DEAL, SUM(GL[$amount]), SUM(DETAIL[$amount]), SomeCalculationForVariance on the SUMS
So if you have any ideas on how I can get there, please do share, you'll save me hours of research.
Thanks so very much.!!