I have two tables in my PowerBI Model, 'Players' and 'PlayerAttributes', which are connected by 'player_id' column.
我的PowerBI模型中有两个表‘Players’和‘PlayerAttributes’,它们通过‘PERAYER_ID’列相连。
I'm trying to create a measure that will be showing a maximum of total stats (which is a metric created by summing all stats values for every player) from a group of players which position is the same as the position of the currently chosen player.
我正在尝试创建一个度量,它将显示与当前选择的球员的位置相同的一组球员的最大总统计数据(这是一个通过将每个球员的所有统计数据求和而创建的度量)。
The created measure looks like this:
创建的度量如下所示:
MaxTotalAttributesPosition =
VAR SamePosition = FILTER(Players, Players[position] = SELECTEDVALUE(Players[position]))
VAR Filtered = FILTER(PlayerAttributes, PlayerAttributes[player_id] = SamePosition[player_id])
VAR Data = SUMMARIZE(
ALL(Filtered),
PlayerAttributes[player_id],
"AttrSum", SUM(PlayerAttributes[Value])
)
RETURN
CALCULATE(MAXX(Data, [AttrSum]))
When trying to evaluate this measure i get the error: "Cannot find table 'SamePosition'." I suspect that the way I'm using the Filter() function is not correct, because the interpreter cannot recognize tables created via Filter function.
在尝试评估此度量时,我收到错误:“找不到表‘SamePosition’。”我怀疑我使用Filter()函数的方式不正确,因为解释器无法识别通过Filter函数创建的表。
更多回答
优秀答案推荐
我是一名优秀的程序员,十分优秀!