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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
jhowe1
Helper III
Helper III

Header and line Sum measures best practise

Hi all, 

 

Apologies if there is a very simple answer to this but I can't seem to find a best practise solution.  If I have two tables WorkOrder (header) and Booking (line), what is the best way to SUM a value from booking per WorkOrder? A WorkOrder doesn't necessarily always have a booking, and a WorkOrder can potentially have multiple bookings. Booking has a foreign key to WorkOrder. What is the best/most efficient DAX for measure WorkOrderDuration? Thanks.

 

WorkOrder  Booking    
WorkOrderKeyMeasure WorkOrderDuration = 'SUM(Booking[BookingDuration]) GROUPED BY WorkOrderKey' BookingKeyWorkOrderKeyBookingDuration Measure BookingDuration = 'SUM(Booking[BookingDuration])'
150 1130 30
235 2120 20
340 3235 35
420 4340 40
550 5420 20
645 6550 50
725 7645 45
845 8725 25
90 9830 30
100 10815 15
1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@jhowe1 , Not able to get what is issue with SUM(Booking[BookingDuration])

It should work with columns for both work order and bookings

 

Any values at work order level, if need work with details van be used like

sumx(values(WorkOrder[WorkOrderKey]), calculate(Max(WorkOrder[Value])))

 

 

View solution in original post

3 REPLIES 3
V-lianl-msft
Community Support
Community Support

Hi @jhowe1 ,

 

Based on your description, table WorkOrder  has a one to many relationship with table Booking. The calculation of power Bi is aggregated at the row level. When you use the columns in the WorkOrder  table to display measure, it will always aggregate at the row level based on the way of your measure expressions.

 

Best Regards,
Liang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

amitchandak
Super User
Super User

@jhowe1 , Not able to get what is issue with SUM(Booking[BookingDuration])

It should work with columns for both work order and bookings

 

Any values at work order level, if need work with details van be used like

sumx(values(WorkOrder[WorkOrderKey]), calculate(Max(WorkOrder[Value])))

 

 

Hi thanks for your reply, there was no issue with SUM(Booking[BookingDuration) my question was how to sum the booking duration (line level) at header level (workorder) but maybe i am confusing things and it will just work depending on context i am in. i.e. if i am looking at table with booking key it will sum line by line, but if looking at table with work order key it will sum by work order key (grouped). Hi can you let me know if my understanding is correct?

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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