Forum Discussion
Tarte
2 years agoNew Member
DAX command for MIN MAX in horometer
Hi everyone, I have a table containing meter readings for several machines: Machine Date hour A 01/07/2024 1000 A 10/07/2024 1100 A 23/07/2024 1150 B 09/07/2024 200 B...
- 2 years ago
Tarte What happens if you ditch the ALL in your filter clause?
Calculate = VAR __Machine = MAX( 'Table'[Machine] ) VAR __Date = MAX( 'Table'[Date] ) VAR __Result = CALCULATE( MAX( 'Table'[hour] ), 'Table'[Machine] = __Machine, YEAR( 'Table'[Date] ) = YEAR( __Date ), MONTH( 'Table'[Date] ) = MONTH( __Date ) ) RETURN __ResultAlso, here is a No CALCULATE approach:
NC = VAR __Machine = MAX( 'Table'[Machine] ) VAR __Date = MAX( 'Table'[Date] ) VAR __Table = FILTER( ALLSELECTED( 'Table' ), [Machine] = __Machine && YEAR( [Date] ) = YEAR( __Date ) && MONTH( [Date] ) = MONTH( __Date ) ) VAR __Result = MAXX( __Table, [hour] ) RETURN __Result - Anonymous2 years ago
Hi Tarte
Thanks for the reply from Greg_Deckler.
The following measures are for your reference.
MinMonth = CALCULATE(MIN([hour]), ALLEXCEPT('Table', 'Table'[Machine]), MONTH('Table'[Date]) = MONTH(MAX([Date])))MaxMonth = CALCULATE(MAX([hour]), ALLEXCEPT('Table', 'Table'[Machine]), MONTH('Table'[Date]) = MONTH(MAX([Date])))Output:
Best Regards,
Yulia XuIf this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
2 years agoNot applicable
Hi Tarte
Thanks for the reply from Greg_Deckler.
The following measures are for your reference.
MinMonth = CALCULATE(MIN([hour]), ALLEXCEPT('Table', 'Table'[Machine]), MONTH('Table'[Date]) = MONTH(MAX([Date])))MaxMonth = CALCULATE(MAX([hour]), ALLEXCEPT('Table', 'Table'[Machine]), MONTH('Table'[Date]) = MONTH(MAX([Date])))
Output:
Best Regards,
Yulia Xu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.