Forum Discussion

Blastoise's avatar
Blastoise
New Member
3 years ago

Weighted Average Power BI

I am trying to get a weighted average for an absolute % error.  Weighting is on units sold (product quantity) per item (item ID).  I am able to get correct answers at a "branch plant" (AU01, EU01, SU01) but can not seem to get the correct answer at the category level (Paper, Kits).  

 

Here is the formula I am using (I am new to DAX so this is the autogenerated "quick measure" that Power BI create).  

 

Weighted Absolute % Error =
DIVIDE(
    SUMX(
        KEEPFILTERS(VALUES('Item Attributes'[Item ID])),
        CALCULATE([Absolute Error %] * [Product Quantity])
    ),
    SUMX(
        KEEPFILTERS(VALUES('Item Attributes'[Item ID])),
        CALCULATE([Product Quantity])
    )
)
 
Using a matrix table if I use category as a subset of warehouse the numbers are accurate. 

 

But if I flip the category and market, the category numbers are incorrect, but the warehouse numbers are correct.  

 

 

What do I need to change in order to have the category numbers apprear correclty? 
 
Thank you for your help.  
No RepliesBe the first to reply