Forum Discussion
Anonymous
5 years agoNot applicable
Max value in a counting measure
Hello everyone 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 t...
- 5 years ago
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.
v-alq-msft
Community Support
5 years agoHi, 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.