Supplies are limited. Contact info@espc.tech right away to save your spot before the conference sells out.
Get your discountScore big with last-minute savings on the final tickets to FabCon Vienna. Secure your discount
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) |
1 | 5 | 8/23/2023 9:00 | 1 | 0 | 0 |
1 | 5 | 8/23/2023 9:01 | 2 | 60 | 0 |
1 | 5 | 8/23/2023 9:02 | 3 | 120 | 0 |
1 | 5 | 8/23/2023 9:03 | 4 | 180 | 0 |
1 | 5 | 8/23/2023 9:04 | 4 | 180 | 60 |
1 | 5 | 8/23/2023 9:05 | 4 | 180 | 120 |
1 | 5 | 8/23/2023 9:06 | 4 | 180 | 180 |
1 | 5 | 8/23/2023 9:07 | 4 | 180 | 240 |
1 | 5 | 8/23/2023 9:08 | 4 | 180 | 320 |
1 | 4 | 8/23/2023 9:09 | 0 | 0 | 0 |
1 | 4 | 8/23/2023 9:10 | 1 | 60 | 0 |
1 | 4 | 8/23/2023 9:11 | 2 | 120 | 0 |
1 | 4 | 8/23/2023 9:12 | 3 | 180 | 0 |
2 | 5 | 8/23/2023 9:00 | 1 | 0 | 0 |
2 | 5 | 8/23/2023 9:01 | 2 | 60 | 0 |
2 | 5 | 8/23/2023 9:02 | 3 | 120 | 0 |
2 | 5 | 8/23/2023 9:03 | 4 | 180 | 0 |
3 | 5 | 8/23/2023 9:00 | 1 | 0 | 0 |
3 | 5 | 8/23/2023 9:01 | 2 | 60 | 0 |
3 | 5 | 8/23/2023 9:02 | 3 | 120 | 0 |
3 | 5 | 8/23/2023 9:03 | 4 | 180 | 0 |
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.
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:
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?
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 | Time | Pages Printed | Uptime (seconds) | Downtime (seconds) |
1 | 5 | 8/23/2023 9:00 | 1 | 0 | 0 |
1 | 5 | 8/23/2023 9:01 | 2 | 60 | 0 |
1 | 5 | 8/23/2023 9:02 | 3 | 120 | 0 |
1 | 5 | 8/23/2023 9:03 | 4 | 180 | 0 |
1 | 5 | 8/23/2023 9:03 | 4 | 180 | 60 |
1 | 5 | 8/23/2023 9:03 | 4 | 180 | 120 |
1 | 5 | 8/23/2023 9:04 | 4 | 180 | 180 |
1 | 5 | 8/23/2023 9:05 | 4 | 180 | 240 |
1 | 5 | 8/23/2023 9:06 | 4 | 180 | 320 |
1 | 5 | 8/23/2023 9:07 | 0 | 0 | 0 |
1 | 4 | 8/23/2023 9:08 | 1 | 60 | 0 |
1 | 4 | 8/23/2023 9:09 | 2 | 120 | 0 |
1 | 4 | 8/23/2023 9:10 | 3 | 180 | 0 |
2 | 5 | 8/23/2023 9:00 | 1 | 0 | 0 |
2 | 5 | 8/23/2023 9:01 | 2 | 60 | 0 |
2 | 5 | 8/23/2023 9:02 | 3 | 120 | 0 |
2 | 5 | 8/23/2023 9:03 | 4 | 180 | 0 |
3 | 5 | 8/23/2023 9:00 | 1 | 0 | 0 |
3 | 5 | 8/23/2023 9:01 | 2 | 60 | 0 |
3 | 5 | 8/23/2023 9:02 | 3 | 120 | 0 |
3 | 5 | 8/23/2023 9:03 | 4 | 180 | 0 |
1 | 5 | 8/23/2023 15:00 | 1 | 0 | 0 |
1 | 5 | 8/23/2023 15:01 | 2 | 60 | 0 |
1 | 5 | 8/23/2023 15:02 | 3 | 120 | 0 |
1 | 5 | 8/23/2023 15:03 | 4 | 180 | 0 |
1 | 5 | 8/23/2023 15:04 | 4 | 180 | 60 |
1 | 5 | 8/23/2023 15:05 | 4 | 180 | 120 |
1 | 5 | 8/24/2023 9:00 | 1 | 0 | 0 |
1 | 5 | 8/24/2023 9:01 | 2 | 60 | 0 |
1 | 5 | 8/24/2023 9:02 | 3 | 120 | 0 |
1 | 5 | 8/24/2023 9:03 | 4 | 180 | 0 |
1 | 5 | 8/24/2023 9:04 | 4 | 180 | 60 |
1 | 5 | 8/24/2023 9:05 | 4 | 180 | 120 |
1 | 5 | 8/24/2023 9:06 | 4 | 180 | 180 |
1 | 5 | 8/24/2023 9:07 | 4 | 180 | 240 |
2 | 5 | 8/24/2023 9:00 | 1 | 0 | 0 |
2 | 5 | 8/24/2023 9:01 | 2 | 60 | 0 |
2 | 5 | 8/24/2023 9:02 | 3 | 120 | 0 |
2 | 5 | 8/24/2023 9:03 | 4 | 180 | 0 |