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
Anonymous
Not applicable

DAX - run on tabke with summarize

Hi,

 

i have the following table:

 

Prod_ Order No_Operation No_Previous Operation No_Posting_DateOutput QTY from operation"Delay"
MO00030531030910/24/201910
MO00030531131010/25/201911
MO00030531231110/25/201910
MO00030531331210/26/201911
MO00030531431310/27/201911

 

i need  count the days between every operation, only for the the one that didnot occur on the same day,and make  a total count for these days as "delay days".( i have added the delay coulmn)

on the original table i have many "prod _order_NO" with many operations and dates and QTY.

i need in the calcualtion to stop when the last operation is the current operation, and prudece the following:

 

Prod_ Order No_Operation No_Previous Operation No_Delay daysOutput QTY
MO00030531431331

 

thanks!!!!

 

Ofir 

1 ACCEPTED SOLUTION
Nathaniel_C
Super User
Super User

@Anonymous ,

 

If I understand the issue, try this: My table is prodDelay



delay days.PNG

 

Delay sum = 
var _maxNo = CALCULATE(MAX(prodDelay[Operation No_]),ALLEXCEPT(prodDelay,prodDelay[Prod_ Order No_]))
var _sumDelay = CALCULATE(SUM(prodDelay[Delay]), ALLEXCEPT(prodDelay,prodDelay[Prod_ Order No_]))



return   IF(prodDelay[Operation No_] = _maxNo,_sumDelay)


Let me know if you have any questions.

If this solves your issues, please mark it as the solution, so that others can find it easily. Kudos are nice too.
Nathaniel 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




View solution in original post

2 REPLIES 2
Nathaniel_C
Super User
Super User

@Anonymous ,

 

If I understand the issue, try this: My table is prodDelay



delay days.PNG

 

Delay sum = 
var _maxNo = CALCULATE(MAX(prodDelay[Operation No_]),ALLEXCEPT(prodDelay,prodDelay[Prod_ Order No_]))
var _sumDelay = CALCULATE(SUM(prodDelay[Delay]), ALLEXCEPT(prodDelay,prodDelay[Prod_ Order No_]))



return   IF(prodDelay[Operation No_] = _maxNo,_sumDelay)


Let me know if you have any questions.

If this solves your issues, please mark it as the solution, so that others can find it easily. Kudos are nice too.
Nathaniel 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Anonymous
Not applicable

Hi!

 

Thank you very much for the response.

 

do you use the "ALLEXCEPT" function to be able to isolate between the "

Prod_ Order No_"?
 
Is there a way also to count the dalay days beween every opertaion to visual this in a table?
 
Thanks in advance!!
 
ofir
 

@Nathaniel_C 

 

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.

Top Solution Authors