Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
I am looking for some assistance to create a measure that results in a weighted average price for products that share a common variable - in this case, products that share a common age.
The weighted average should take into account not only the prices of all products with the same age, but also the ‘brand rankings’.
To illustrate what I am seeking, please see the example below:
As you can see, not all product ages have price examples from each of the brand ranks - the measure would need to be able to handle this.
I am unsure if this is something to tackle within the Excel file, or if we can achieve it in PowerBI. To assist, please see the following links for the Excel file and my attempts at a Power BI model.
Can anyone help please? Thanks in advance.
Solved! Go to Solution.
Hi, this measure should do it. Just add it to your table visualisation
Weighted Avg = VAR SelectedAge = SELECTEDVALUE ( 'All Price Points'[Age] ) RETURN CALCULATE ( DIVIDE ( SUMX ( 'All Price Points', SWITCH ( RELATED ( 'BRAND RANKINGS'[Brand Rank] ), 1, 0.7, 2, 0.15, 3, 0.15 ) * 'All Price Points'[Price] ), SUMX ( 'All Price Points', SWITCH ( RELATED ( 'BRAND RANKINGS'[Brand Rank] ), 1, 0.7, 2, 0.15, 3, 0.15 ) ) ), ALL ( 'All Price Points' ), 'All Price Points'[Age] = SelectedAge )
Hi, this measure should do it. Just add it to your table visualisation
Weighted Avg = VAR SelectedAge = SELECTEDVALUE ( 'All Price Points'[Age] ) RETURN CALCULATE ( DIVIDE ( SUMX ( 'All Price Points', SWITCH ( RELATED ( 'BRAND RANKINGS'[Brand Rank] ), 1, 0.7, 2, 0.15, 3, 0.15 ) * 'All Price Points'[Price] ), SUMX ( 'All Price Points', SWITCH ( RELATED ( 'BRAND RANKINGS'[Brand Rank] ), 1, 0.7, 2, 0.15, 3, 0.15 ) ) ), ALL ( 'All Price Points' ), 'All Price Points'[Age] = SelectedAge )
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
112 | |
97 | |
85 | |
68 | |
59 |
User | Count |
---|---|
150 | |
120 | |
99 | |
87 | |
68 |