Forum Discussion
Predictions based on past performance
- 4 years ago
Anonymous Yeah, you'll have syntax errors when you wing it, there was an offending comma. Try:
Measure Total Points = VAR __Player = MAX('Table'[Player]) VAR __Team = MAX('Table'[Team]) VAR __Table = ADDCOLUMNS( ADDCOLUMNS( SUMMARIZE('Table',[Type]), "__Team",__Team, "__PPM",[Points/Match]), "__FutureGames", MAXX(FILTER('MatchesTableNextYear',[Team]=__Team && [Attribute]=[Type]),[Value]) ), "__Points",[__PPM] * [__FutureGames] ) RETURN SUMX(__Table,[__Points])It's that last comma just above the first line you get the squilly red line under.
Anonymous Assuming that you have that as a table visualization? First, you will need to unpivot your type columns (X, Y and Z) in your future matches table and then maybe a measure like:
Measure Total Points =
VAR __Team = MAX('Table'[Team])
VAR __Type = MAX('Table'[Type])
VAR __PointsPerMatch = [Points/Match] //assumes a measure
VAR __TotalMatches = MAXX(FILTER('MatchesTableNextYear',[Team]=__Team && [Attribute]=__Type),[Value])
RETURN
__PointsPerMatch * __TotalMatches
Greg_Deckler , thanks for the reply.
This seem to work if I then display this on a table with 'Type' as a column:
The calculated values are fine.
However, if I take out 'Type' column (ultimately I want to know each player's total predicted points), then the summation seems to give me an incorrect value:
For instance PlayerA's total should be 500 + 112.5 + 225 = 837.50.
The resulting value, 252.40, doesn't even seem to be the average (which should be 837.5 / 3 = 279.16), so wonder what's happening here.
- Greg_Deckler4 years ago
Community Champion
Anonymous So what about this?
Measure Total Points = VAR __Player = MAX('Table'[Player]) VAR __Team = MAX('Table'[Team]) VAR __Table = ADDCOLUMNS( ADDCOLUMNS( SUMMARIZE('Table',[Type]), "__Team",__Team, "__PPM",[Points/Match]), "__FutureGames", MAXX(FILTER('MatchesTableNextYear',[Team]=__Team && [Attribute]=[Type]),[Value]), ), "__Points",[__PPM] * [__FutureGames] ) RETURN SUMX(__Table,[__Points])- Anonymous4 years agoNot applicable
- Greg_Deckler4 years ago
Community Champion
Anonymous Yeah, you'll have syntax errors when you wing it, there was an offending comma. Try:
Measure Total Points = VAR __Player = MAX('Table'[Player]) VAR __Team = MAX('Table'[Team]) VAR __Table = ADDCOLUMNS( ADDCOLUMNS( SUMMARIZE('Table',[Type]), "__Team",__Team, "__PPM",[Points/Match]), "__FutureGames", MAXX(FILTER('MatchesTableNextYear',[Team]=__Team && [Attribute]=[Type]),[Value]) ), "__Points",[__PPM] * [__FutureGames] ) RETURN SUMX(__Table,[__Points])It's that last comma just above the first line you get the squilly red line under.