Forum Discussion
Running Total
- 10 years ago
Eyy, I think I got it. Try this:
RunningTotal2 = MAXX(Table1, SUMX( FILTER( SUMMARIZE(CALCULATETABLE(Table1, ALLEXCEPT(Table1, Table1[Building]), ALLSELECTED(Table1[Building])), Table1[MachineName], "NetVal", SUM(Table1[Fabrication Net Value])), [NetVal] >= SUMX(FILTER(CALCULATETABLE(Table1, ALLEXCEPT(Table1, Table1[Building]), ALLSELECTED(Table1[Building])), Table1[MachineName]= EARLIER(Table1[MachineName], 2)), Table1[Fabrication Net Value])) , [NetVal]))
Hopefully you can see how that would scale out to other columns if you had multiple filters.
Here is the measure I used and the results:
RunningTotal = MAXX(vwScalesDataFabricationNetValue, CALCULATE(SUM(vwScalesDataFabricationNetValue[Fabrication Net Value]), vwScalesDataFabricationNetValue[Fabrication Net Value] >= EARLIER(vwScalesDataFabricationNetValue[Fabrication Net Value]), ALL(vwScalesDataFabricationNetValue)))
| Ranking | MachineName | Fabrication Net Value | RunningTotal |
| 1 | Quarrata | 21003 | 74934 |
| 2 | Rollpacks | 16752 | 87249 |
| 3 | Tightwinder | 12390 | 78010 |
| 4 | T8 ( 2 ) | 10217 | 87114 |
| 5 | T8 ( 4 ) | 5821 | 88776 |
| 6 | Cut off saw | 5801 | 89000 |
| 7 | OEM VCC's | 5133 | 88822 |
| 8 | T8 ( 3 ) | 2509 | 85088 |
| 9 | T8 (1 ) | 2155 | 76690 |
| 10 | Tarp saw | 1906 | 88949 |
| 11 | Mattress | 1435 | 79222 |
| 12 | OEM CNC | 1126 | 89020 |
| 13 | T8 ( 5 ) | 889 | 88625 |
| 14 | Fillmatic | 724 | 35792 |
| 15 | Quality Samples | 497 | 85254 |
| 16 | C52 Pillow Machine | 309 | 88977 |
| 17 | Bun Roller Machine | 229 | 62330 |
| 18 | Chinese Carousel | 124 | 78134 |
Is each row of the table showing one row in the source data, or a number of rows in the source data?
EDIT: If you have the ranking created already, you can probably just replace the Fabrication Net Value with Ranking everywhere but in the SUM, and it should work.
- Lucy6410 years agoAdvocate II
It is the total of several rows per machine.
- jahida10 years agoImpactful Individual
If you have the ranking created already, you can probably just replace the Fabrication Net Value with Ranking everywhere but in the SUM, and it should work.
I could write a new measure but this seems like the easiest way.
MAXX(vwScalesDataFabricationNetValue, CALCULATE(SUM(vwScalesDataFabricationNetValue[Fabrication Net Value]), vwScalesDataFabricationNetValue[Ranking] >= EARLIER(vwScalesDataFabricationNetValue[Ranking]), ALL(vwScalesDataFabricationNetValue)))
- Lucy6410 years agoAdvocate II
Tried it but got an error :
A function 'CALCULATE' has been used in a True/False expression that is used as a table filter expression. This is not allowed.
The ranking is a measure not a calculated column, does that make a difference? I have underlined the section highlighted for error.
Running Total = MAXX(vwScalesDataFabricationNetValue, CALCULATE(SUM(vwScalesDataFabricationNetValue[Fabrication Net Value]), vwScalesDataFabricationNetValue[Ranking] >= EARLIER(vwScalesDataFabricationNetValue[Ranking]), ALL(vwScalesDataFabricationNetValue)))