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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
Anonymous
Not applicable

Calculating Fill Rate - With Exclusions

Hi all

Trying to wrap my head around trying to make this work. I'm trying to calculate two separate fillrates - Absolute Fill Rate (Total Units Shipped / Total Units Ordered), and Qualified Fill Rate. Qualified Fill Rate would be calculated the same, but excluding ifitem has been ordered more than once in the same week that was shipped 0 units (effectively, after the first Qty Shipped = 0 the rest would be excluded for the rest of the week). For example:

 

Item NumberCustomer NumberDateWeekNumQty OrderedQty Shipped
101990012020-01-0111010
101990012020-01-0211010
101990012020-01-031100
101990012020-01-041100

 

For this example, my Absolute Fill Rate for WeekNum=1 be calulated by:

Qty Shipped / Qty Ordered = (10+10+0+0) / (10+10+10+10) = 20/40 = 50%.

 

For this example, my Qualified Fill Rate for WeekNum=1 be calculatd by:

Qty Shipped / Qty Ordered = (10+10+0) / (10+10+10) = 20/30 = 67%

 

Any thoughts how I might accomplish this?

 

Thanks

 

2 ACCEPTED SOLUTIONS
mahoneypat
Employee
Employee

Here are two expressions that get your expected results from your example data

 

Filled =
DIVIDE ( SUM ( Orders[Qty Shipped] ), SUM ( Orders[Qty Ordered] ) )

Qualified =
VAR __filled =
    SUM ( Orders[Qty Shipped] )
VAR __ordersnonzero =
    CALCULATE ( SUM ( Orders[Qty Ordered] ), Orders[Qty Shipped] <> 0 )
VAR __orderszero =
    SUMX (
        VALUES ( Orders[WeekNum] ),
        VAR mindate =
            CALCULATE ( MIN ( Orders[Date] ), Orders[Qty Shipped] = 0 )
        RETURN
            CALCULATE (
                SUM ( Orders[Qty Ordered] ),
                Orders[Qty Shipped] = 0,
                Orders[Date] = mindate
            )
    )
RETURN
    DIVIDE ( __filled, __ordersnonzero + __orderszero )

 

If this works for you, please mark it as the solution.  Kudos are appreciated too.  Please let me know if not.

Regards,

Pat





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


View solution in original post

Ashish_Mathur
Super User
Super User

Hi,

You may download my PBI file from here.

Hope this helps.

Untitled.png


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

View solution in original post

2 REPLIES 2
Ashish_Mathur
Super User
Super User

Hi,

You may download my PBI file from here.

Hope this helps.

Untitled.png


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
mahoneypat
Employee
Employee

Here are two expressions that get your expected results from your example data

 

Filled =
DIVIDE ( SUM ( Orders[Qty Shipped] ), SUM ( Orders[Qty Ordered] ) )

Qualified =
VAR __filled =
    SUM ( Orders[Qty Shipped] )
VAR __ordersnonzero =
    CALCULATE ( SUM ( Orders[Qty Ordered] ), Orders[Qty Shipped] <> 0 )
VAR __orderszero =
    SUMX (
        VALUES ( Orders[WeekNum] ),
        VAR mindate =
            CALCULATE ( MIN ( Orders[Date] ), Orders[Qty Shipped] = 0 )
        RETURN
            CALCULATE (
                SUM ( Orders[Qty Ordered] ),
                Orders[Qty Shipped] = 0,
                Orders[Date] = mindate
            )
    )
RETURN
    DIVIDE ( __filled, __ordersnonzero + __orderszero )

 

If this works for you, please mark it as the solution.  Kudos are appreciated too.  Please let me know if not.

Regards,

Pat





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel1

Power BI Monthly Update - May 2024

Check out the May 2024 Power BI update to learn about new features.