Forum Discussion
Sum multiple columns from multiple tables? How to?
- 10 years ago
heathernicole just add the 3 Measures into a new one (or 2 Measures and 1 SUM(Column))
EDIT: as to kcantor point about the Relationship View - we just need to see the tables involved in this calculation and the columns connecting them
- 10 years ago
Speaking to the extra 2000: Unlike in excel, PowerPivot and PowerBI calculate each 'cell's' individual total based upon the calculations. Each cell is an island so to speak. While it may only show up once in your visual, within the calculation itself it must appear more than one time. There is a reference card that helps with this issue and it can be found here:
http://www.powerpivotpro.com/2015/10/giving-back-steal-this-reference-card/
As for your data model . . . wow. Do you need all of those tables for this particular use? I only ask because a coworker of mine tried to use one data model for everything and it slowed it down to a crawl. A smaller, more nimble datamodel can quickly be created for many projects. She had about 10 fact tables and no lookup tables.
How many actual tables are you using from this diagram for this partiular project and have you dropped any columns you don't need to reduce size?
In general, I have 4 lookup tables that I match to most fact tables. My largest model uses 5 fact tables but I keep the column count as low as possible to reduce size and calculation time. Also, are you populating your rows from a lookup table or from a fact table? Using a fact table as row values can cause many issues and play Mary Hobb with your numbers.
- 10 years ago
heathernicole Obiviously your Bonus Points Measure is the Problem...
In the bottom total row it defaults to the value between 25000 and 49999 because thats the total in the bottom row
Therefore you need to convert it to a Calculated Column instead of a Measure (use same formula)
Then create a Measure that will sum that Column and then add all 3...
- 10 years ago
Looking at the screen captures it appears that the grand total is recalculating the bonus points total based upon the grand totals of the other columns. You can either swich to a calculated column or look at using a much longer workaround.
this will also affect subtotals.
Edit: Looks like Sean beat me to that one. :)
- 10 years ago
last ditch effort here:
Go back to the original measure that worked correctly in the row but not in the grand total. Apply the 'fix' from this blog post to correct how the total is calculating.
http://www.powerpivotpro.com/2012/03/subtotals-and-grand-totals-that-add-up-correctly/
The problem is only the grand total as it meets the other critera for raising points. If you correct it to calculate differenlty it should solve the issue.
- 10 years ago
heathernicole I created this sample data to hopefully resemble what you are working with
The 3 Tables are related this way
Try the formula highlighted in the image below
It worked for me! I hope it works for you too! Let me know...
Got it! Almost anyhow... it's really close. The spreadsheet is doing something funky with the totals row and column... here's a shot... Why is adding 2000? It's SO CLOSE to being right :( The problem is even in a graph it's adding that extra 2000. Any ideas or thoughts???
RE: Relationships... I can't get them on all in one shot - the tables are too big. :( But here's a go at it...
Here's the graph total for one rep...
Speaking to the extra 2000: Unlike in excel, PowerPivot and PowerBI calculate each 'cell's' individual total based upon the calculations. Each cell is an island so to speak. While it may only show up once in your visual, within the calculation itself it must appear more than one time. There is a reference card that helps with this issue and it can be found here:
http://www.powerpivotpro.com/2015/10/giving-back-steal-this-reference-card/
As for your data model . . . wow. Do you need all of those tables for this particular use? I only ask because a coworker of mine tried to use one data model for everything and it slowed it down to a crawl. A smaller, more nimble datamodel can quickly be created for many projects. She had about 10 fact tables and no lookup tables.
How many actual tables are you using from this diagram for this partiular project and have you dropped any columns you don't need to reduce size?
In general, I have 4 lookup tables that I match to most fact tables. My largest model uses 5 fact tables but I keep the column count as low as possible to reduce size and calculation time. Also, are you populating your rows from a lookup table or from a fact table? Using a fact table as row values can cause many issues and play Mary Hobb with your numbers.
- kcantor10 years agoCommunity Champion
It didn't do it in the chart because you do not have a grand total in the chart. You can go into the matrix design and drop the grand total for a quick fix but I would be more interested in why it is adding it twice in the grand total.
The resource I sent you is a reference card. The first page explains how to step through a measure to determine where that measure is breaking down. It seems to be working everywhere other than at the grand total which makes it difficult to track the issue. If we were working in PowerPivot, i would suggest manually filtering your data model by that particular sales rep to see where the extra points are coming from but, as I am still relatively new to PowerBI as well, I am not sure how to go about doing that within PowerBI.
Of course, now that I know that I don't know how to do that, I will be learning how to do it as soon as possible. If I make a discovery pretty quickly, I will let you know.
- heathernicole10 years agoContinued Contributor
kcantor - thanks for the resource! I haven't had a chane to delve into yet- there's a lot there.
In short - does that mean that there isn't a way to correct that behavior?
It didn't do it in this chart: ???
RE: Relationships. MOST of those tables are lookup tables. The main one is the Sales Details table. Pretty much all of the others are lookups. In this particular model I use the Sales Details, Sales rep, Customer, and Calendar - Transaction table.
My goal is to trim down the extra tables next. I'm kind of nervous because I don't know what that will do. So I'm going to make a copy of this report and then try it on a dummy first. It will be too heady to work with at that size after awhile.
That extra two thousand points may be a bit of an issue... I need to see if there's a way to keep it from doing that. I'll look into that resource you sent. THANKS!! :)