Forum Discussion
Anonymous
5 years agoNot applicable
Weight Average
Hello, I'm looking to get help with a formula that will get me the weighted average based off a set of paramters. I would like the formula to take the sum of spend per material number and divide ...
- 5 years ago
This the DateAdd (-1 Year) option instead of the DATE command..... (Sorry for the change in TABLE name and columns in the version below vs. my original post.) But you only have to change the FILTER Portion to use DATEADD vs. DATE(Y)(M)(D)
1_Year_Avg_Spend = CALCULATE( SUM( 'Table'[USD Spend]) / SUM('Table'[Qty]), FILTER( 'Table', 'Table'[Document Date] > DATEADD('Table'[Document Date], -1, YEAR))) - 5 years ago
Try this....
Last_Pur_Price = CALCULATE( AVERAGE( 'Table'[Part Price]), FILTER('Table', 'Table'[Document Date] = [Last_Pur_Date]))If you had multiple sales on the same day, assuming you want the average of the two?
Anonymous
5 years agoNot applicable
So the measure works when I have all material numbers. When I filter down to just one of them I get the error. Any way to stop this?
fhill
5 years agoResident Rockstar
Hmmmm, I'm going to promote this up on the channel. I took your longer sample data, changed every other Part Number, but was still able to produce a calcualtion with 1 Part Number filtered...