Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago
Solved

Weighted Average Calculation

Hey guys! I'm trying to formulate an weighted average for a product data. I have 4k rows of differents IDs divided by 9 categories (prod1 to prod9), each one with a value of time. I need an weighte...
  • littlemojopuppy's avatar
    littlemojopuppy
    5 years ago

    I'm working with my assumption and came up with this...

     

    Weighted Average Product Time = 
        VAR AllProducts = 
            CALCULATETABLE(
                VALUES(Products[Product]),
                ALL(Products)
            )
        VAR	TotalProductCount =
    	    CALCULATE(
    		    [Product Count],
        		ALL(Products)
    	    )
        RETURN 
    
        DIVIDE(
            SUMX(
                AllProducts,
                [Product Count] * [Total Product Time]
            ),
            TotalProductCount,
            BLANK()
        )

     

     

    Here's the results

    Hope this helps!  ğŸ™‚