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
DataUsurper
Helper II
Helper II

Weighted Average is correct, but recalcs when OrderID context is applied

Lo All,

 

I have a correct measure for my weighted average but when I attempt to related our orders w/ a delta calc that wAverage recalcs per order. How can I maintain the static weighted average when applying OrderID Context (see images):

 

Wavg1.pngWavg2.png

 

wAvg_Actual = CALCULATE(SUMX(TBLDATA,((TBLDATA[QTY]*TBLDATA[BILL_DAYS])/7)*TBLDATA[Actual_Price.Disc])/SUMX(TBLDATA,((TBLDATA[BILL_DAYS]/7)*TBLDATA[QTY])),TBLDATA[Actual_Price.Disc]>0)

 

Thank you kindly

1 ACCEPTED SOLUTION
DataUsurper
Helper II
Helper II

Was able to get this to work using "ALLExcept" but I also need a secondary filter for when a field is > 0

 

wAvg_Actual = CALCULATE(SUMX(TBLDATA,((TBLDATA[QTY]*TBLDATA[BILL_DAYS])/7)*TBLDATA[Actual_Price.Disc])/SUMX(TBLDATA,((TBLDATA[BILL_DAYS]/7)*TBLDATA[QTY])),ALLEXCEPT(TBLDATA,TBLDATA[E.CODE]))

View solution in original post

1 REPLY 1
DataUsurper
Helper II
Helper II

Was able to get this to work using "ALLExcept" but I also need a secondary filter for when a field is > 0

 

wAvg_Actual = CALCULATE(SUMX(TBLDATA,((TBLDATA[QTY]*TBLDATA[BILL_DAYS])/7)*TBLDATA[Actual_Price.Disc])/SUMX(TBLDATA,((TBLDATA[BILL_DAYS]/7)*TBLDATA[QTY])),ALLEXCEPT(TBLDATA,TBLDATA[E.CODE]))

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.

Top Solution Authors