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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
zfraz
New Member

Weighted Average

I'm trying to calculate planned efficiencies for production data but am having trouble figuring out how to get the weighted averages based on the standards. I am trying to calculate what % of the day we ran a certain sku to be able to weight the standard efficiency for that product. See data example below:

DateItemRun HoursLBSSTD LbsSTD EFF
5/15/2017123765070060
5/15/201712071300140070
5/15/201712151400150080
5/16/2017123980090060
5/16/2017120101975200070
5/17/201712141525160080
5/17/2017120153300300070

 

The STD Lbs and STD EFF are lookups from the standards table in power bi. The first four columns are loaded from an Access database housing production data. I need to figure out the planned eff dynamically.

 

Ex. On 5/15/17 the total run hours were 19 and we should have had a planned eff  of 72.89 based on the weighted run times over the day, ie. 72.89=(7/19*60)+(7/19*70)+(5/19*80).

 

How can I write a measure for Power BI to do this math for me?

 

Thanks!

1 ACCEPTED SOLUTION
v-yulgu-msft
Employee
Employee

Hi @zfraz,

 

In above table, you can create two calculated columns referring to below DAX formula:

planned eff for each item =
 (
    'Weighted Average'[Run Hours]
        / (
            CALCULATE (
                SUM ( 'Weighted Average'[Run Hours] ),
                ALLEXCEPT ( 'Weighted Average', 'Weighted Average'[Date] )
            )
        )
)
    * 'Weighted Average'[STD EFF]

planned eff =
CALCULATE (
    SUM ( 'Weighted Average'[planned eff for each item] ),
    ALLEXCEPT ( 'Weighted Average', 'Weighted Average'[Date] )
)

 

Best regards,
Yuliana Gu

Community Support Team _ Yuliana Gu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

1 REPLY 1
v-yulgu-msft
Employee
Employee

Hi @zfraz,

 

In above table, you can create two calculated columns referring to below DAX formula:

planned eff for each item =
 (
    'Weighted Average'[Run Hours]
        / (
            CALCULATE (
                SUM ( 'Weighted Average'[Run Hours] ),
                ALLEXCEPT ( 'Weighted Average', 'Weighted Average'[Date] )
            )
        )
)
    * 'Weighted Average'[STD EFF]

planned eff =
CALCULATE (
    SUM ( 'Weighted Average'[planned eff for each item] ),
    ALLEXCEPT ( 'Weighted Average', 'Weighted Average'[Date] )
)

 

Best regards,
Yuliana Gu

Community Support Team _ Yuliana Gu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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