Forum Discussion

ahmer_malick's avatar
ahmer_malick
Icon for Helper II rankHelper II
1 year ago
Solved

Formula Hep with PWBI

If Qty Completed at Current Operation/Shop Order Qty is >90% and Qty Completed at ALL Future Operation is less than 90 % then the shop order is at this operation number else in no qty is posted...
  • v-hashadapu's avatar
    v-hashadapu
    1 year ago

    Hi ahmer_malick , Thank you for reaching out to the Microsoft Community Forum.

     

    Please try below:

    Is_Current_Operation =
    VAR CurrentOrder = Query1[SHOP ORDER]
    VAR CurrentOpSeq = Query1[OPR NBR]
    VAR ShopOrderQty = Query1[SHOP ORD QTY REQ]
    VAR CurrentOpQty = Query1[QTY COMP AT OPS]
    VAR CurrentOpPct = DIVIDE(CurrentOpQty, ShopOrderQty)
    VAR MaxFutureOpPct = MAXX( FILTER( 'Query1', 'Query1'[SHOP ORDER] = CurrentOrder && 'Query1'[OPR NBR] > CurrentOpSeq ), DIVIDE('Query1'[QTY COMP AT OPS], 'Query1'[SHOP ORD QTY REQ]) )
    VAR TotalPostedQty = CALCULATE( SUM('Query1'[QTY COMP AT OPS]), FILTER( 'Query1', 'Query1'[SHOP ORDER] = CurrentOrder ) )
    VAR FirstOpSeq = CALCULATE( MIN('Query1'[OPR NBR]), FILTER( 'Query1', 'Query1'[SHOP ORDER] = CurrentOrder ) )
    RETURN IF( CurrentOpPct > 0.9 && (ISBLANK(MaxFutureOpPct) || MaxFutureOpPct < 0.9), "Yes", IF( (ISBLANK(TotalPostedQty) || TotalPostedQty = 0) && CurrentOpSeq = FirstOpSeq, "Yes", "No" ) )