Forum Discussion
GustavoKamchen
3 years agoFrequent Visitor
Filter Max hour by Date
Hello everybody. I want to filter the table below to show me the column "Production" for the maximum hour of every day. How can I do this? Date Hour Production 01/01/2022 05:00:00 1...
- Anonymous3 years ago
HI GustavoKamchen,
You can create a calculated column with the following formula to use the current date to find 'hour', then use the above 'hour' and current date to get the corresponding Production values.
formula = VAR _maxhour = CALCULATE ( MAX ( Table[Hour] ), FILTER ( Table, [Date] = EARLIER ( Table[Date] ) ) ) RETURN CALCULATE ( MAX ( Table[Production] ), FILTER ( Table, [Date] = EARLIER ( Table[Date] ) && [Hour] = _maxhour ) )EARLIER, EARLIEST – DAX Guide - SQLBI
Regards,
Xiaoxin Sheng
Anonymous
3 years agoNot applicable
HI GustavoKamchen,
You can create a calculated column with the following formula to use the current date to find 'hour', then use the above 'hour' and current date to get the corresponding Production values.
formula =
VAR _maxhour =
CALCULATE (
MAX ( Table[Hour] ),
FILTER ( Table, [Date] = EARLIER ( Table[Date] ) )
)
RETURN
CALCULATE (
MAX ( Table[Production] ),
FILTER ( Table, [Date] = EARLIER ( Table[Date] ) && [Hour] = _maxhour )
)
EARLIER, EARLIEST – DAX Guide - SQLBI
Regards,
Xiaoxin Sheng
GustavoKamchen
3 years agoFrequent Visitor
How can I calculate average of daily production?