Hierarchy:Region>Sub Region>Facility>Address>Location
I’m trying to calculate total appts by address. For levels higher than Address, it will sum the appt at each address under that level. For levels lower than Address(For example, location), it will ignore that level and calculate at address level.
DAX:
Testing Appt by Address=
SUMX (
ADDCOLUMNS (
VALUES(‘Rooms’[Rooms Address])
,
“A”,
CALCULATE([Number of Appointments] ,ALLSELECTED('Rooms')
)
),[A]
)
Confusion: I don’t understand why it returned correct numbers at address and location levels ,but incorrect at levels higher than address(It looks like it did Number of Address * Total Appt at that Level, for example at Georgetown, 2*279). It 's like VALUES() didn’t filter.
I also tried:
- wrapping it in another calculate and didn’t work:
CALCUALTE(CALCULATE([Number of Appointments] ,ALLSELECTED(‘Rooms’)) - Adding values() within CALCULATE and didn’t work:
CALCULATE([Number of Appointments] ,ALLSELECTED(‘Rooms’), VALUES(‘Rooms’[Rooms Address]))
3.Wrapping 2 within calculate, it worked:
CALCULATE(CALCULATE([Number of Appointments] ,ALLSELECTED(‘Rooms’),VALUES(‘Rooms’[Rooms Address])))
Can someone please explain to me why Testing Appt by Address,Testing Appt by Address Tyr 1, and Testing Appt by Address Tyr2 didnt work?
Thank you.