I'm keeping track of machines & their on/off status, and their service history:
MachineHistory
MachID
Branch
Status
StatusDate
ServiceHistory
ServiceID
MachID
ServiceDate
Calendar
Date
Year
Month
MachineHistory and ServiceHistory are related on MachId. Calendar is related to both on the date cols.
What I want is measures for ActiveMachineCount (means Status = "ON") and ServicedMachineCount (means row exists in ServiceHistory table). Both should be group-able by date & branch.
So I should be able to have an excel pivot that shows eg
Branch ActiveMachCnt ServicedMachCnt
A 50 13
B 23 6
I have a measure of MachIdCnt = distinctcount(machineid) My problem is with ActiveMachIdCnt = calculate([MachIdCnt], MachineHistory[Status] = "ON")
No matter how I try to fiddle with ActiveMachIdCnt, I either get a) literally ALL of the machine id's in the table, or b) a count of machine id's that have been serviced (due to relationship).
I'm clearly not understanding the ALL, ALLEXCEPT, etc family of functions correctly. :/
How can I get the ActiveMachIdCnt measure to "ignore" the relationship to ServiceHistory, but still respect filters on date & branch?
Thanks for any tips, sff