Forum Discussion
olmie_fresh
1 year agoRegular Visitor
Help with ALLEXCEPT NOT WORKING
Hello, I have a table with table (list) of Maintenance Work Orders - one work order per row, where there is a "Open Date" and "CLosed Date" column to denote timestamp of each WO (if not closed, is "C...
Anonymous
1 year agoNot applicable
Hi olmie_fresh,
Could you please ensure that 'Date - Open and Closed' table has active relationships with both Open Date and Closed Date in Maintenance Work Orders?
BTW, I guess the MONTH() maybe the issue as well, I suggest you use EOMONTH() or separate year and month as below.
Please try to use CALCULATE() with explicit filters to respect page-level context:
Orders Closed =
VAR _SelectedDate = MAX('Date - Open and Closed'[Date]) // Get the date from the visual
VAR _StartDate = DATE(YEAR(_SelectedDate), MONTH(_SelectedDate), 1) // First day of the selected month
VAR _EndDate = DATE(YEAR(_SelectedDate), MONTH(_SelectedDate) + 1, 1) - 1 // Last day of the selected month
RETURN
CALCULATE(
COUNTROWS('Maintenance Work Orders'),
'Maintenance Work Orders'[Closed Date] >= _StartDate,
'Maintenance Work Orders'[Closed Date] <= _EndDate,
NOT(ISBLANK('Maintenance Work Orders'[Closed Date]))
)
Here is another measure for the opened orders:
Orders Opened =
VAR _SelectedDate = MAX('Date - Open and Closed'[Date]) // Get the date from the visual
VAR _StartDate = DATE(YEAR(_SelectedDate), MONTH(_SelectedDate), 1) // First day of the selected month
VAR _EndDate = DATE(YEAR(_SelectedDate), MONTH(_SelectedDate) + 1, 1) - 1 // Last day of the selected month
RETURN
CALCULATE(
COUNTROWS('Maintenance Work Orders'),
'Maintenance Work Orders'[Open Date] >= _StartDate,
'Maintenance Work Orders'[Open Date] <= _EndDate
)
Best Regards,
Qi
Community Support Team
If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!