Forum Discussion
Anonymous
3 years agoNot applicable
Weighted AVG DAX calculation
Hi All - This is basically where i pick the fields needed from two tables. My error is coming from the "Sheet1" table where it flags the field with red line. On looking up the meaning of th...
- 3 years ago
Anonymous
In your example, which one is table sheet1? Also please confirm that the relationship is one to many single way
- 3 years ago
Anonymous
Please try
Weighted Avg = VAR T1 = RELATEDTABLE ( Sheet2 ) VAR T2 = FILTER ( T1, Sheet2[Market_Price] <> BLANK () && Sheet2[HAS_Analytics] = 1 ) RETURN SUMX ( T2, DIVIDE ( Sheet2[Market_Value] * Sheet2[Market_Price], Sheet2[Market_Value] ) )
tamerj1
3 years agoCommunity Champion
Anonymous
Please try
Weighted Avg =
VAR T1 =
RELATEDTABLE ( Sheet2 )
VAR T2 =
FILTER ( T1, Sheet2[Market_Price] <> BLANK () && Sheet2[HAS_Analytics] = 1 )
RETURN
SUMX (
T2,
DIVIDE ( Sheet2[Market_Value] * Sheet2[Market_Price], Sheet2[Market_Value] )
)
Anonymous
3 years agoNot applicable
So, under the filter is 2 different tables and not just Sheet1. [Market_Price] should be filtered from Sheet2.
- tamerj13 years agoCommunity Champion
Anonymous
Sorry I got confused. I edited the code again please check. Again we are creating the column in sheet1 and all related columns are in sheet2