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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

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
Community Champion
Community Champion

@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
Community Champion
Community Champion

@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
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 community update carousel

Fabric Community Update - June 2025

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