Forum Discussion

JenniferZen's avatar
JenniferZen
Regular Visitor
3 years ago

Dax measure based on different levels

Hi,

 

I have these four measure to calculate the sum of items based on each level i.e., Store-->Company-->Locality-->Region

The below measures are not working as expected to show all the totals calculated based on each level on the top row ? But if I slice in , the sum on each level is fine ? can somebody help me to correct the formula, please?

 

Edit : What I am trying to achieve is the sum of items on hierarchical level without filters.

 

 

1.Store Items 
calculate([Store Items],filter(all(Calendar),max(Calendar[CalendarKey])<=[CalendarOldForYTD] && max(Calendar[CalendarKey])>=[CalendarForYTD]))
 
Store Items  : CALCULATE (SUM(WarehouseData[Items])
 
2.Locality Items 
 
calculate([Locality Items],filter(all(Calendar),max(Calendar[CalendarKey])<=[CalendarOldForYTD] && max(Calendar[CalendarKey])>=[CalendarForYTD]))
 
[Locality Items] :CALCULATE(SUM(WarehouseData[Items]),ALL(Store[StoreName]),ALL(Store[StoreCode]))
 
 
3.Company Items 
calculate([Company Items],filter(all(Calendar),max(Calendar[CalendarKey])<=[CalendarOldForYTD] && max(Calendar[CalendarKey])>=[CalendarForYTD]))
 
Company Items  : CALCULATE(SUM(WarehouseData[Items]),ALL(Store[StoreName]),ALL(Store[StoreCode]),ALL(Store[LocalityName])
 
 
4.Region Items 
calculate([Region Items],filter(all(Calendar),max(Calendar[CalendarKey])<=[CalendarOldForYTD] && max(Calendar[CalendarKey])>=[CalendarForYTD]))
 
Region Items  : CALCULATE(SUM(WarehouseData[Items]),ALL(Store[StoreName]),ALL(Store[StoreCode]),ALL(Store[LocalityName]),ALL(Store[CompanyName]),ALL(Store[CompanyCode]))
 
Thanks
Jenni