Issue with rows not summing to the correct number! Help need for work!

chryslerDAWGs

New Member
Joined
Oct 8, 2015
Messages
3
I have been stumped by this issue for the past few days trying to sum up the rows based on this MAXX formula in PowerPivot.

Code:
highest Sched Prod Time (min):=MAXX(summarize(Stations,Stations[Station],"Duration1",IF(sum([prdDur])*2<[Station time In Cycle],[Station time In Cycle],sum([prdDur]))),[Duration1])/600

Basically I want it to sum up the productive duration by station over a period of time and if it is 2 times greater than the "station time in cycle" use the sum of that time and sum for the month the total time .

Issue I am having is if I break it down by every day in a month. I get the correct output for that day, but when I look at the summation of all of them, it is not correct. I believe what is happening is it takes the total productive duration of the entire month and compares it to the total "station time in cycle" and chooses the max between those instead of looking at each day.

Below are the values I have for each day and then the sum of the month. Month according to PowerPivot is 588.8, but if you were to sum the rows you would get 614.1.

How do I get the whole month the sum the individual dates by a station?

station 580
September588.8
9/1/201520.4
9/2/201520.4
9/3/201520.4
9/4/201520.4
9/5/201520.4
9/6/201523.2
9/7/201522.5
9/8/201519.0
9/9/201519.0
9/10/201520.4
9/11/201520.4
9/12/201520.4
9/13/201520.4
9/14/201520.4
9/15/201520.4
9/16/201520.4
9/17/201520.4
9/18/201520.4
9/19/201520.4
9/20/201520.4
9/21/201520.4
9/22/201520.4
9/23/201520.4
9/24/201520.4
9/25/201520.4
9/26/201520.4
9/27/201520.4
9/28/201520.4
9/29/201520.4
9/30/201520.4

<tbody>
</tbody>
 

Excel Facts

Excel Joke
Why can't spreadsheets drive cars? They crash too often!
I didn't totally understand the goal, so my answer is... a bit generic.

The general pattern for solving "hey, my grand total doesn't sum correctly" is
BetterResult := SUMX(VALUES(Calendar[Day]), [Result])

So, for any individual Day... the result is the same (SUMX on 1 item...). But for grand total, it will add the [Result] per day, to get a grand total.
 
Upvote 0
I didn't totally understand the goal, so my answer is... a bit generic.

The general pattern for solving "hey, my grand total doesn't sum correctly" is
BetterResult := SUMX(VALUES(Calendar[Day]), [Result])

So, for any individual Day... the result is the same (SUMX on 1 item...). But for grand total, it will add the [Result] per day, to get a grand total.


Okay I will try to explain in a little more detail what I am looking at.

I have a table with events corresponding to dates.

For instance

Table name: Events

Date____Station_Dept_Event__PrdDur_PnpDur
1/1/2012 STA155 1210 IN CYCLE 655 655
1/1/2012 STA155 1210 Blocked 4234 4234
1/1/2012 STA284 2460 IN CYCLE 500 500
1/1/2012 STA155 1210 IN CYCLE 0 4584
1/1/2012 STA284 2460 Starved 6548 6548
1/2/2012 STA284 2460 IN CYCLE 3456 3456
1/2/2012 STA155 2460 IN CYCLE 320 320

Station time in Cycle:=calculate(sum([pnpDur]),Events[State]="IN CYCLE")

highest Sched Prod Time (min):=MAXX(summarize(Events,Events[Station],"Duration1",IF(sum([prdDur])*2<[Station time In Cycle],[Station time In Cycle],sum([prdDur]))),[Duration1])/600

etc and there are over 1 million of these events archived in the past few months.

What I need it to do is take the station with the highest PrdDur in each department for each day thus I used MAXX.
There can be 100+ stations but all I need is the one with the highest PrdDur for that day after summing all the PrdDur.
The IF statement is thrown in because for instance sometimes the "Station in Cycle" time has to replace the PrdDur if the PrdDur shows up as zero.
I want these to sum up to show my month total by department summing just the max duration of each day.

That's how I get the table in the original message where each day has a max for the line and then the sum at the top which is the issue since it does not sum up each day after evaluating the IF statement.
 
Upvote 0
I would give my "typical" answer above a try, and see how that works out for you. If it doesn't work out... we can figure it out :)
 
Upvote 0

Forum statistics

Threads
1,215,914
Messages
6,127,690
Members
449,398
Latest member
m_a_advisoryforall

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top