Forum Discussion
Weighted Average every 24 hours
- Anonymous6 years ago
Hi Yak2792 ,
First, please add one Index field for the related table in Power Query Editor. Then create a calculated column to get the average of Weighted Bonus:
Weighted Bonus = DIVIDE ( CALCULATE ( MAX ( 'Bonus'[Bonus Calculation] ), FILTER ( ALL ( 'Bonus' ), 'Bonus'[Index] - 1 = EARLIER ( 'Bonus'[Index] ) ) ) * 12 + 'Bonus'[Bonus Calculation] * 12, 24 )add index column
create calculated columnBest Regards
Rena
I should also mention that this is currently all done with measures, and is being presented in a table.
Can you share some sample actual raw data.
- Yak27926 years agoRegular Visitor
What raw data would you need? The data is coming from 4 different SQL tables, so it might be a bit of a mess. I have one table that has the calendar, 2 that contain product information, and another that contains bonus multpliers depending on certain criteria.
Would the table presented in the initial post with details of how the bonus is calculated suffice?
- Anonymous6 years agoNot applicable
Hi Yak2792 ,
First, please add one Index field for the related table in Power Query Editor. Then create a calculated column to get the average of Weighted Bonus:
Weighted Bonus = DIVIDE ( CALCULATE ( MAX ( 'Bonus'[Bonus Calculation] ), FILTER ( ALL ( 'Bonus' ), 'Bonus'[Index] - 1 = EARLIER ( 'Bonus'[Index] ) ) ) * 12 + 'Bonus'[Bonus Calculation] * 12, 24 )add index column
create calculated columnBest Regards
Rena
- Yak27926 years agoRegular Visitor
Thank you for the reponse Anonymous .
Your solution would be super easy, but unfortunately these are not stored in a table, they are calculated measures, as well as columns from data pulled from 3 different tables. You can see this below.
Is it possible to create a new table with this information in it? I looked at this link, but in my case it won't work becasue the tables I'm trying to join are different sizes, one is a shift calendar and the other is the product information.
I guess as a fall back I could always enter data manually and then use the solution you provided, but ideally I would like to automate this as much as possible, as this report will be used by somebody else who is not a familiar with Power BI.