Forum Discussion
pbi_wannabe_exp
4 years agoRegular Visitor
Weighted AVG Calculation
Hey all,
I have the following data table with many names but I only copied the table with 2 names now: setup.py and path.xyz. (date, name, loc_i, loc_d columns are originally in the table, and AGE, Weight, Weighted AVG are calculated.
| date | name | loc_i | loc_d | AGE | Weight | Weighted AVG | |
| 24/01/22 13:20:06 | setup.py | 41 | 0 | 129.44 | 33 | 4271.664375 | |
| 27/01/22 11:31:23 | setup.py | 1 | 1 | 126.52 | 1 | 126.5198727 | |
| 28/01/22 08:54:20 | setup.py | 1 | 1 | 125.63 | 1 | 125.6289352 | |
| 09/03/22 08:22:06 | setup.py | 2 | 2 | 85.65 | 2 | 171.3026389 | |
| 05/04/22 07:57:04 | setup.py | 1 | 0 | 58.67 | 1 | 58.6687037 | |
| 05/04/22 07:54:23 | setup.py | 1 | 0 | 58.67 | 1 | 58.67056713 | |
| 27/01/22 09:45:36 | setup.py | 2 | 2 | 126.59 | 2 | 253.1866667 | |
| 28/01/22 08:46:19 | setup.py | 2 | 2 | 125.63 | 2 | 251.2690046 | 123.6491 |
| 24/01/22 13:20:06 | path.xyz | 35 | 0 | 129.44 | 26 | 3365.55375 | |
| 27/01/22 11:31:23 | path.xyz | 2 | 1 | 126.52 | 2 | 253.0397454 | |
| 28/01/22 08:54:20 | path.xyz | 1 | 0 | 125.63 | 1 | 125.6289352 | |
| 09/03/22 08:22:06 | path.xyz | 1 | 0 | 85.65 | 1 | 85.65131944 | |
| 05/04/22 07:57:04 | path.xyz | 1 | 0 | 58.67 | 1 | 58.6687037 | |
| 05/04/22 07:54:23 | path.xyz | 1 | 1 | 58.67 | 1 | 58.67056713 | |
| 27/01/22 09:45:36 | path.xyz | 1 | 1 | 126.59 | 1 | 126.5933333 | |
| 28/01/22 08:46:19 | path.xyz | 1 | 1 | 125.63 | 1 | 125.6345023 | |
| 24/01/22 13:30:06 | path.xyz | 1 | 1 | 129.44 | 1 | 129.4374306 | |
| 28/01/22 11:31:23 | path.xyz | 2 | 2 | 125.52 | 2 | 251.0397454 | |
| 28/01/22 08:55:20 | path.xyz | 2 | 2 | 125.63 | 2 | 251.2564815 | 123.8763 |
Here you can see the formulas behind the calculated columns:
I would like to create the final calculation in PBI somehow (please note that my data table consists of more than 2 names - thousands).
Many thanks in advance!
Wavg = divide(sumx('Table','Table'[AGE]*'Table'[Weight]),sumx('Table','Table'[Weight]))see attached
3 Replies
- lbendlinSuper User
Wavg = divide(sumx('Table','Table'[AGE]*'Table'[Weight]),sumx('Table','Table'[Weight]))see attached
- pbi_wannabe_expRegular Visitor
Many thanks for your reply!! One thing I dont know is that how I can add weight calculation to the pbi. Only date, name, loc_i, loc_d is in the model. I understand how to add a calculated column measure in case of AGE and Weighted AVG, but what about Weight?
- lbendlinSuper User