基于另一列中不同值的平均值

发布于 2025-01-17 21:14:37 字数 1487 浏览 3 评论 0原文

对于我的项目,我需要创建一个条形图,其中类别轴是汇总和值轴的平均值为rowcount()。 我找不到直接在Bar-ohart中直接计算总和的平均值的方法。

在这里您可以找到所需的步骤计算最终值( 85,26 )。

我使用计算列(在附加的数据集中突出显示)来解决解决方案,但是我需要直接在条形图中计算出来,以便在应用过滤器时会更改。

我试图更好地解释。我的KPI使用以下公式计算:

Sum([Weight]) OVER ([Period],[ID Player],[Player Type],[ID Game],[Player Role])) OVER ([ID 
Player],[Player Type],[ID Game],[Player Role])>

平均值是在以下值上完成的:

(83,50 83,50 83,50 83,50 83,50 83,50 83,50 83,50 83,50 86,14 86,14 86,14 86,14 86,14 86,14 86,14 86,14)/16 = 84,82

所以我尝试添加不同的结果,但是结果仍然不正确,因为以下值完成了平均值:

(83,50+86,14)\ 2 = 84,82

平均值应基于“周期”列的不同值

(83,50+86,14+86,14)\ 3 = 85,26

谁能帮助我找到一个公式来获得最后一个平均水平?

提前致谢!

EDIT1:我尝试了一个公式,该公式接近评论中的建议:

Sum([Weight] * [Score]) OVER ([Period],[ID Player],[Player Type],[ID Game],[Player Role]) / Sum([Weight]) OVER ([Period],[ID Player],[Player Type],[ID Game],[Player Role])
,null)) OVER ([ID Player],[Player Type],[ID Game],[Player Role])

但是它将在每个时期的平均值(60+97+97+97/3 = 84,67)中的平均值。

For my project I need to create a bar-chart where category axis is the average of an aggregated sum and value axis is rowcount().
I can't find a way to calculate the average of an aggregated sum directly in the bar-chart.

Here you can find the dxp file with steps required to calculate the final value (85,26).

I came to a solution using the calculate columns (highlighted in the dataset attached), but I need to calculate it directly in the bar-chart so it will change when filters are applied .

I tried to explain better. My KPI is calculated using the following formula:

Sum([Weight]) OVER ([Period],[ID Player],[Player Type],[ID Game],[Player Role])) OVER ([ID 
Player],[Player Type],[ID Game],[Player Role])>

The average is done on the following values:

(83,50 83,50 83,50 83,50 83,50 83,50 83,50 83,50 86,14 86,14 86,14
86,14 86,14 86,14 86,14 86,14)/16 = 84,82

So I tried to add DISTINCT but the result was still incorrect since the average is done for the following values:

(83,50+86,14)\2 = 84,82

The average should be based on distinct values from "Period" column so

(83,50+86,14+86,14)\3 = 85,26

Can anyone help me to find a formula to obtain the last average?

Thanks in advance!

EDIT1: I tried a formula that's close to the suggestion in the comments:

Sum([Weight] * [Score]) OVER ([Period],[ID Player],[Player Type],[ID Game],[Player Role]) / Sum([Weight]) OVER ([Period],[ID Player],[Player Type],[ID Game],[Player Role])
,null)) OVER ([ID Player],[Player Type],[ID Game],[Player Role])

But it will do the average taking just first values for each period (60+97+97/3=84,67)
enter image description here

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

毅然前行 2025-01-24 21:14:39

不确定您如何设置可视化,但是类似以下公式可能会起作用

Avg(case when Rank(RowId(),[Period])=1 then [final Score] end)

Not sure how you have set up the visualisation, but something like the following formula might work

Avg(case when Rank(RowId(),[Period])=1 then [final Score] end)
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文