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
jordy233
Frequent Visitor

How to calculate the correct time per order on order level and employee level?

I have a question about how to calculate the correct time per order on order level and employee level.

Multiple employees could work on one order.

 

In the example below, employee 1 has a total time of 16,85 on order B, and Employee 2 has worked 8,47 on order B. The sum of this order is 25,32 (column ‘Sum of order’). In DAX I created the following measure:

 

Sum of order =

    CALCULATE(

        SUM('table 1'[Total time per order]),

        ALL(table 2[employee_fullname]),

        VALUES(table 3[OrderNr]))

 

However, the total amount is incorrect when filtering on employee. In the example below, I’ve shown two overviews. Overview 1: no filter on employee. The total of column Amount is calculated correctly. Overview 2: a filter on employee (show only employee 1). The total of column Amount is calculated incorrectly.

 

Did I make a mistake in the DAX measure? Of how can I solve this issue?

 

jordy233_0-1636972160156.png

 

3 REPLIES 3
amitchandak
Super User
Super User

@jordy233 , Ideally inthis case simple sum should work

 

Sum of order =

Sumx( VALUES(table 3[OrderNr]), calculate(SUM('table 1'[Total time per order]) ) )

Thanks for your reply. However, this is not the solution. The calculated total amount is 2517,75 in stead of 1872,21.

 

It includes the total time of employee 2 as well. 

 

Have you got other ideas?

Hi @jordy233 ,

 

How was your Amount formula written?

It is very helpful for me to share your pbix file with me.

 

 

 

Best Regards,

Stephen Tao

 

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

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.