Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Score big with last-minute savings on the final tickets to FabCon Vienna. Secure your discount

Reply
PowerBIUser27
Helper I
Helper I

Cumulative data hard to aggregate - how to calculate totals?

Hello! I've got a problem with some cumulative printer data. The data is broken out by Machine (printer), Recipe (what's being printed), Time, Pages Printed, Uptime (how long the printer has been working), and Downtime (how long the printer has not been working).

 

The twist: all of the recorded data is cumulative per Machine and Recipe - see below. Each machine prints one page per minute, so the "Pages Printed" count starts at 1, then 2, etc. The rightmost three columns are all cumulative. You can see machine 1 turn off at 9:04 below, then back on at 9:09 with a new recipe.

 

Machine    Recipe    Time    Pages Printed    Uptime (seconds)    Downtime (seconds)
158/23/2023 9:00100
158/23/2023 9:012600
158/23/2023 9:0231200
158/23/2023 9:0341800
158/23/2023 9:04418060
158/23/2023 9:054180120
158/23/2023 9:064180180
158/23/2023 9:074180240
158/23/2023 9:084180320
148/23/2023 9:09000
148/23/2023 9:101600
148/23/2023 9:1121200
148/23/2023 9:1231800
258/23/2023 9:00100
258/23/2023 9:012600
258/23/2023 9:0231200
258/23/2023 9:0341800
358/23/2023 9:00100
358/23/2023 9:012600
358/23/2023 9:0231200
358/23/2023 9:0341800

 

The issue: with multiple machines and recipes being used, how do I calculate the pages printed by each machine, not to mention the uptime/downtime for each machine? 

 

Right now, I'm doing a simple MAX() - MIN() for each, but that is often wrong. Notice the change in Recipe at 9:09 for machine 1, that "zeros" out the Pages Printed and other metrics, which will then cause errors in a simple MAX - MIN formula.

6 REPLIES 6
foodd
Super User
Super User

While not providing individual measures mentioned. Your ask for calculating SUM of Printed Pages, Uptime, Downtime can be achieved by pivoting with a matrix

automatically groups and totals as below:

foodd_0-1693329835936.png

 

Those sums are incorrect - which hits at the problem here. These numbers are cumulative, we can't just add all Downtime numbers together. The correct downtime for Machine 1 is 320. 

 

Same idea with Pages Printed. Machine 1 printed 4 total pages for recipe 5, and 3 pages for recipe 4.

Sorry, read too quickly, and again, these are not measures, It is only an example matrix pivot

with Rows (Machine and Recipe), and Values (Pages, Uptime, and Down at 

Maximum).   Drill down, you see the breakdown by Machine and Recipe.  

Are you evaluating for an Ideal recipe?

 

foodd_0-1693332143843.png

 

Yep, I tried something similar as well. Unfortunately, if the printers stop and start with the same recipe, the data becomes invalid.

 

Let's say Machine 1 prints for 2 hours in the morning, then 1 hour at night. Taking the max would only give us the Pages Printed, Uptime, etc for that morning session, not the night time session. That's what I'm not sure how to account for in DAX.

How many machines are we speaking of?  Would you please expand the sample data size to represent more machines and longer periods of several days and down to the minute level that you have now?  This will produce a better work product.

Sure, I can expand the sample data, see below. I just added some more example rows with more print sessions later in the day. And as you can see, taking the Max won't provide us with the correct total pages printed through an hour, day, or whatever time frame users select (week, month, etc).

 

Machine   Recipe   TimePages Printed   Uptime (seconds)   Downtime (seconds)   
158/23/2023 9:00100
158/23/2023 9:012600
158/23/2023 9:0231200
158/23/2023 9:0341800
158/23/2023 9:03418060
158/23/2023 9:034180120
158/23/2023 9:044180180
158/23/2023 9:054180240
158/23/2023 9:064180320
158/23/2023 9:07000
148/23/2023 9:081600
148/23/2023 9:0921200
148/23/2023 9:1031800
258/23/2023 9:00100
258/23/2023 9:012600
258/23/2023 9:0231200
258/23/2023 9:0341800
358/23/2023 9:00100
358/23/2023 9:012600
358/23/2023 9:0231200
358/23/2023 9:0341800
158/23/2023 15:00100
158/23/2023 15:012600
158/23/2023 15:0231200
158/23/2023 15:0341800
158/23/2023 15:04418060
158/23/2023 15:054180120
158/24/2023 9:00100
158/24/2023 9:012600
158/24/2023 9:0231200
158/24/2023 9:0341800
158/24/2023 9:04418060
158/24/2023 9:054180120
158/24/2023 9:064180180
158/24/2023 9:074180240
258/24/2023 9:00100
258/24/2023 9:012600
258/24/2023 9:0231200
258/24/2023 9:0341800

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.