Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
JenniferZen
Regular Visitor

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.

JenniferZen_0-1689081109026.png

 

 

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

 

1 REPLY 1
amitchandak
Super User
Super User

@JenniferZen , I think you need a role-playing dimension here

 

https://radacad.com/userelationship-or-role-playing-dimension-dealing-with-inactive-relationships-in...

 

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.