Forum Discussion
Syndicate_Admin
4 years agoAdministrator
Filter-weighted average
Good afternoon, please if someone can help me with a measure that can filter the result by weighting the Indicator with respect to the existing amount per Year / Center / Winery since in some I repea...
- 3 years ago
Hi Anonymous
Sorry for the late reply. You can create a measure with below DAX to get the weighted average indicator.
New Indicator = VAR _table = ADDCOLUMNS ( ADDCOLUMNS ( SELECTCOLUMNS ( 'Table', "Quantity", 'Table'[Quantity], "Indicator", 'Table'[Indicator] ), "Percentage of quantity", DIVIDE ( [Quantity], SUM ( [Quantity] ) ) ), "Apportionment", [Percentage of quantity] * [Indicator] ) RETURN SUMX ( _table, [Apportionment] )Best Regards,
Community Support Team _ Jing
If this post helps, please Accept it as Solution to help other members find it.
Syndicate_Admin
4 years agoAdministrator
Thank you for the help lcreo to solve it in this way:
Indicator = SUMX('tabla1',('Bi Sowing'[Quantity])*('table1' [indicator]))/sum('table1' [Quantity])
I have filter by year and center on the sheet, the idea is that for cases that are repeated the indicator is representative according to the center / winery according to the amount that each indicator has
| Year | Center | Wine cellar | Quantity | Indicator | Percentage of quantity | Apportionment |
| 2018 | Rabudos | 102 | 42947 | 3,6 | 77% | 2,75954808 |
| 2018 | Rabudos | 102 | 13080 | 2,4 | 23% | 0,56030128 |
| 56027 | 3,32 |
v-jingzhang
3 years agoCommunity Support
Hi Anonymous
Sorry for the late reply. You can create a measure with below DAX to get the weighted average indicator.
New Indicator =
VAR _table =
ADDCOLUMNS (
ADDCOLUMNS (
SELECTCOLUMNS (
'Table',
"Quantity", 'Table'[Quantity],
"Indicator", 'Table'[Indicator]
),
"Percentage of quantity", DIVIDE ( [Quantity], SUM ( [Quantity] ) )
),
"Apportionment", [Percentage of quantity] * [Indicator]
)
RETURN
SUMX ( _table, [Apportionment] )
Best Regards,
Community Support Team _ Jing
If this post helps, please Accept it as Solution to help other members find it.
- Anonymous3 years agoNot applicable
Thank you very much, it was perfect