- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

Max value in a counting measure
I have two tables, an agenda and a production,
I have two tb measurements, one that calculates the machine's production in the month and the other that calculates the days worked.
I would like to calculate the daily production of the machine by the largest number of days worked each month.
Something similar:
Divide (Production, Days) * Max (Days)
It would be basically the highest value of days worked, that is, a MAX (Count).
In my example in the figure would be:
Return DIVIDE(Production, Days) * 26
Is this possible?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

Hi, @Anonymous
Based on your description, I created data to reproduce your scenario. The pbix file is attached in the end.
Table:
You may create two measures as below.
Count of Days = COUNTROWS('Table')
Result =
var maxdays =
MAXX(
SUMMARIZE(
ALL('Table'),
'Table'[Month],
'Table'[Machine],
"Count of Days",
COUNTROWS('Table')
),
[Count of Days]
)
var newtab =
ADDCOLUMNS(
SUMMARIZE(
'Table',
'Table'[Month],
'Table'[Machine],
"Count",
COUNTROWS('Table'),
"TotalProduction",
SUM('Table'[Production])
),
"Result",
DIVIDE(
[TotalProduction],
[Count]
)*maxdays
)
return
SUMX(
newtab,
[Result]
)
Result:
Best Regards
Allan
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

Hi, @Anonymous
Based on your description, I created data to reproduce your scenario. The pbix file is attached in the end.
Table:
You may create two measures as below.
Count of Days = COUNTROWS('Table')
Result =
var maxdays =
MAXX(
SUMMARIZE(
ALL('Table'),
'Table'[Month],
'Table'[Machine],
"Count of Days",
COUNTROWS('Table')
),
[Count of Days]
)
var newtab =
ADDCOLUMNS(
SUMMARIZE(
'Table',
'Table'[Month],
'Table'[Machine],
"Count",
COUNTROWS('Table'),
"TotalProduction",
SUM('Table'[Production])
),
"Result",
DIVIDE(
[TotalProduction],
[Count]
)*maxdays
)
return
SUMX(
newtab,
[Result]
)
Result:
Best Regards
Allan
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

I bet it could be done if you created a SUMMARIXE DAX table that summarized by Month and machine (or is it only by month?) and get the Count of days Worked as a Column instead of a Measure. Once that is a Column, you can do a MAX( ) function on it.
But I just have to ask this, WHY? Why would you want to calculate a RATE of Production Per Day when you have PARTIAL Months' worth of Production but divide it by the MAX number of days? In the bottom row of your sample, it would be 31.50 / 26.
The reason for needing that metric just doesn't make sense to me. The comparison to any other calculation result is not relevent.
Proud to be a Super User! | |
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

Hi @ToddChitt
In fact, what I'm trying to do with this measure is to calculate a correction factor for the monthly average.
See well:
I have11 machines working in February and 5619.20 produced, if I just average the month I will get 510.83 (5619.20 / 11) per machine.
This value is underestimated for the month's average, given that not all machines worked every day, but by doing the projected calculation I can have an average production per machine closer to the real one.

Helpful resources
Join us at the Microsoft Fabric Community Conference
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Power BI Monthly Update - February 2025
Check out the February 2025 Power BI update to learn about new features.

Subject | Author | Posted | |
---|---|---|---|
03-01-2023 11:48 PM | |||
04-23-2024 07:31 AM | |||
06-24-2024 08:30 PM | |||
08-30-2024 09:54 AM | |||
02-11-2024 11:19 PM |
User | Count |
---|---|
87 | |
81 | |
53 | |
37 | |
35 |