3年销售的平均值

huangapple go评论80阅读模式
英文:

Average of 3 years of sales

问题

  1. 我在Power BI方面还相对新手,但我有一个类似于以下表格的数据:
  2. | 年份 | 销售额 |
  3. | -------- | -------- |
  4. | 2019 | 335 |
  5. | 2019 | 730 |
  6. | 2020 | 430 |
  7. | 2020 | 358 |
  8. 表格中还有更多信息,但您可以看到,每年有多个不同的销售条目,数据从2018年到2023年。我想要找出2020年至2022年所有销售额的平均值。我期望得到一个数值(将2020年至2022年的销售额相加,然后除以3),以用于Y轴上的线图。
  9. 我开始编写一个新的度量,但在以下部分卡住了。我希望得到一些帮助,以更新这个度量,以获得正确的数值。

3年平均 = SUMX(FILTER(
'表格',
'表格'[年份] > "2019"); '表格'[销售额])

英文:

I'm still quite new at Power BI but i have a table that is similar to this:

Year Sales
2019 335
2019 730
2020 430
2020 358

There is more information in the table but as you can see i have multiple different sales entries for each year and the data dates from 2018-2023. I would like to find the average of all the sales from 2020-2022. I am expecting 1 figure (adding all the sales from 2020-2022 then diving it by 3) to use in the line y axis.

I started writing a new measure but i got stuck after this. I am hoping to get some help updating this to give me the correct figure.

  1. 3_year_avg = SUMX(FILTER(
  2. 'table',
  3. 'table'[year] > "2019"); 'table'[sales])

答案1

得分: 0

  1. 3年平均 =
  2. SUMX(
  3. FILTER(
  4. all('表'),
  5. '表'[年份] > "2019"
  6. ),
  7. '表'[销售额]
  8. )
英文:

Can you try this below-

  1. 3_year_avg =
  2. SUMX(
  3. FILTER(
  4. all('table'),
  5. 'table'[year] > "2019"
  6. ),
  7. 'table'[sales]
  8. )

huangapple
  • 本文由 发表于 2023年3月9日 12:57:51
  • 转载请务必保留本文链接:https://go.coder-hub.com/75680576.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定