Forum Discussion
On Time total order level correct
- 1 year ago
Sales Order On Time =
VAR a =
ADDCOLUMNS (
VALUES ( 'Table'[Order] ), -- get distinct order numbers
"r", CALCULATE ( COUNTROWS ( 'Table' ) ), -- get number of line items per order
"o",
CALCULATE (
COUNTROWS ( 'Table' ),
'Table'[Sales Order Count Lines On Time] = 1 -- get number of line items per order that are on time
)
)
RETURN
COUNTROWS ( FILTER ( a, [r] = [o] && [o] > 0 ) ) -- count the number of orders where all line items are on time (the number of "on time" line items is not zero, and matches the number of total order line items
Thanks, it is not working in mine dataset yet. Could you explain your steps?
Sales Order On Time =
VAR a =
ADDCOLUMNS (
VALUES ( 'Table'[Order] ), -- get distinct order numbers
"r", CALCULATE ( COUNTROWS ( 'Table' ) ), -- get number of line items per order
"o",
CALCULATE (
COUNTROWS ( 'Table' ),
'Table'[Sales Order Count Lines On Time] = 1 -- get number of line items per order that are on time
)
)
RETURN
COUNTROWS ( FILTER ( a, [r] = [o] && [o] > 0 ) ) -- count the number of orders where all line items are on time (the number of "on time" line items is not zero, and matches the number of total order line items