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?
fhill
5 years agoResident Rockstar
Just saw you updated sample, please let me know if the code I just posted helps you get to your solution without me having to re-do all the code.
Thank You,
Forrest
fhill
5 years agoResident Rockstar
Is you Date column in the original data formatted to be a Date Value in Power BI?
FOrrest