Forum Discussion

mattkarriker's avatar
mattkarriker
Helper I
9 years ago
Solved

Roll up Calculations

Hello Forum

Having an issue and I am not sure how to complete.  I am looking for a way to compute order fill rate at different levels.  The first level is at the line level.  I need to compute the percentage that the line was filled.  I get this pretty easily.  I then need to score the line as 100% filled or not with a calculation to return yes or no.  At the order level I need to know how many lines were 100% filled / total order lines for a percentage of lines filled.  This is where I run into issues.  Below is a simplified view of the data and attempts as the needed calcs.  Any suggestions?  Thank you in advance for your help. 

 

Order NumberLine NumberOrderLine_keyCancelled Qty Shipped QtyBackordered Qty   
111-1 2    
121-2221   
131-3 5    
141-42     
         
         
Calcs 
Order Qty = Cancelled Qty + Shipped Qty + Backordered Qty
Line Fill Rate = Shipped Qty/Order Qty
Line Filled = If Line Fill Rate = 1 then Yes else No
Order Line Fill Rate = Cacluate(DistinctCount(Line_Key),Line Filled = Yes)/DistinctCount(Line_Key)
         
         
Order NumberLine NumberOrderLine_keyCancelled Qty Shipped QtyBackordered QtyOrder QtyLine Fill RateLine Filled
111-1 2 21Yes
121-222150.4No
131-3 5 51Yes
141-42  20No
         
Order NumberOrder Line Fill Rate       
10.5       
  • Hi mattkarriker,

     

    In your scenario, please create calculated columns like below:

     

    Oder Qty = Table1[Cancelled Qty] +Table1[Shipped Qty] +Table1[Backordered Qty]
    Line Fill Rate = DIVIDE(Table1[Shipped Qty],Table1[Oder Qty],0)
    Line Filled = IF(Table1[Line Fill Rate]=1,"Yes","No")

     

    Then create a measure like this:

     

    Order Line Fill Rate = DIVIDE(CALCULATE(DISTINCTCOUNT(Table1[OrderLine_key]),FILTER(ALL(Table1),'Table1'[Line Filled]="Yes")),CALCULATE(DISTINCTCOUNT(Table1[OrderLine_key]),ALL(Table1)))

     

     

    You can download attached .pbix file to have a look.

     

    Best Regards,
    Qiuyun Yu

1 Reply

  • v-qiuyu-msft's avatar
    v-qiuyu-msft
    Community Support

    Hi mattkarriker,

     

    In your scenario, please create calculated columns like below:

     

    Oder Qty = Table1[Cancelled Qty] +Table1[Shipped Qty] +Table1[Backordered Qty]
    Line Fill Rate = DIVIDE(Table1[Shipped Qty],Table1[Oder Qty],0)
    Line Filled = IF(Table1[Line Fill Rate]=1,"Yes","No")

     

    Then create a measure like this:

     

    Order Line Fill Rate = DIVIDE(CALCULATE(DISTINCTCOUNT(Table1[OrderLine_key]),FILTER(ALL(Table1),'Table1'[Line Filled]="Yes")),CALCULATE(DISTINCTCOUNT(Table1[OrderLine_key]),ALL(Table1)))

     

     

    You can download attached .pbix file to have a look.

     

    Best Regards,
    Qiuyun Yu