Power BI度量:为每个ID找到平均总支出

发布于 2025-02-11 19:29:16 字数 762 浏览 1 评论 0原文

我想在Power BI中创建一个量度,以找到每个ID的总_spend的平均值。我的桌子看起来像这样:

idtotal_spend
1234£34.00
1234£34.00
1234£34.00
4325£56.00
4325£56.00
4325£43.00 43.00
4325£43.00
5678£12.00
5678£12.00

我尝试了:

AvgIDSpend=
AVERAGEX (
SUMMARIZE (
Table,
Table[ID],
"Total Average", SUM( DISTINCT ( Table[Total_spend] )
),
[Total Average]
)

但是得到了此错误 -函数仅接受列参考作为参数。

I want to create a measure in Power Bi that finds the average of the total_spend for each ID. My table looks like this:

IDTotal_Spend
1234£34.00
1234£34.00
1234£ 34.00
4325£ 56.00
4325£ 56.00
4325£ 43.00
4325£ 43.00
5678£ 12.00
5678£ 12.00

I've tried:

AvgIDSpend=
AVERAGEX (
SUMMARIZE (
Table,
Table[ID],
"Total Average", SUM( DISTINCT ( Table[Total_spend] )
),
[Total Average]
)

But got this error- The SUM function only accepts a column reference as an argument.

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

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

发布评论

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

评论(1

甜是你 2025-02-18 19:29:16

最快的方法就是创建一个计算表[total_spend]的平均值的度量。

首先,措施:

Avg_Total_spend =
CALCULATE(
    AVERAGE(Table[Total_spend])
)

然后,您创建一个带有列的新表Visual:

  • table [id]
  • table [avg_total_spend]

or作为表expression:

ADDCOLUMNS(
    SUMMARIZE(
        Table,
        Table[ID]
    ),
    "Average Table_spend",
    Table[Average_Table_spend]
)

The quickest way to do it would be to just create a measure that calculate the average of Table[Total_spend], and then use it in a table visual alongside Table[ID].

First, the measure :

Avg_Total_spend =
CALCULATE(
    AVERAGE(Table[Total_spend])
)

Then, you create a new table visual with columns:

  • Table[ID]
  • Table[Avg_Total_spend]

Or, as a table expression :

ADDCOLUMNS(
    SUMMARIZE(
        Table,
        Table[ID]
    ),
    "Average Table_spend",
    Table[Average_Table_spend]
)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文