我要翻译的内容:如何在Power BI Deneb上对值进行求和?

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

How can I sum the values on Power BI Deneb?

问题

我有一个表格,其中包含我想在Power BI Deneb柱状图上显示的数值。

损失原因 主要数量损失
Chupados 1
通用终止 18530
通用终止 929
通用终止 980
Leitosas 1
Manchas 1

但是这些值没有聚合值叠加在一起,显示的值应该是20.439,而不是分别显示在同一根柱上的18530/929/980。

我使用了以下规范:

{
  "data": {"name": "dataset"},
  
  "layer":[{
      "mark": "bar"},
    {
      "mark": {"type": "text", "color": "black", "xOffset": 8},
        "encoding": {
          "text": {"field": "PrimaryQuantityLoss", "type": "quantitative"}}
    }]
  ,
  
  "encoding": {
    "x": {
      "field": "PrimaryQuantityLoss",
      "type": "quantitative"
    },
    "y": {
      "field": "LossReason",
      "type": "ordinal"
    }
  }
}

我尝试进行总和聚合,但没有成功。

英文:

I have a table with the values that I want to display on Power BI Deneb Bar chart.

LossReason PrimaryQuantityLoss
Chupados 1
Generic Terminate 18530
Generic Terminate 929
Generic Terminate 980
Leitosas 1
Manchas 1

But the values are not aggregating Values stacked one above the others , the value displayed should be 20.439 instead of 18530/929/980 separated on the same bar.

I'm using the following specification:

{
  "data": {"name": "dataset"},
  
  "layer":[{
      "mark": "bar"},
    {
      "mark": {"type": "text", "color": "black", "xOffset": 8},
        "encoding": {
          "text": {"field": "PrimaryQuantityLoss", "type": "quantitative"}}
    }]
  ,
  
  "encoding": {
    "x": {
      "field": "PrimaryQuantityLoss",
      "type": "quantitative"
    },
    "y": {
      "field": "LossReason",
      "type": "ordinal"
    }
  }
}

I tried to do an aggregate by sum, but doesn't worked.

答案1

得分: 0

"PrimaryQuantityLoss"更改为"PrimaryQuantityLoss的总和"。如下,我们可以手动完成。

(1) 转到可视化 > 值 > "PrimaryQuantityLoss" 并选择 总和

(2) 然后会出现一个消息窗口来设置字段。选择 Sum of PrimaryQuantityLoss 作为新分配的字段。

(3) 完成。您会注意到文本编码和x字段都已更新。

新规格如下:

{
  "data": {"name": "dataset"},

  "layer":[{
      "mark": "bar"},
    {
      "mark": {"type": "text", "color": "black", "xOffset": 8},
        "encoding": {
          "text": {"field": "Sum of PrimaryQuantityLoss", "type": "quantitative"}}
    }]
  ,

  "encoding": {
    "x": {
      "field": "Sum of PrimaryQuantityLoss",
      "type": "quantitative"
    },
    "y": {
      "field": "LossReason",
      "type": "ordinal"
    }
  }
}
英文:

Change "PrimaryQuantityLoss" to "Sum of PrimaryQuantityLoss". As below, we can do it manually.


(1) Go to Visualizations > Values > "PrimaryQuantityLoss" and select Sum.

我要翻译的内容:如何在Power BI Deneb上对值进行求和?

(2) Then a message window will appear to set the Field. Select Sum of PrimaryQuantityLoss as newly assigned field.

我要翻译的内容:如何在Power BI Deneb上对值进行求和?

(3) Done. You will notice that the text encoding and the x-field are both renewed.

我要翻译的内容:如何在Power BI Deneb上对值进行求和?

New specification is:

{
  "data": {"name": "dataset"},

  "layer":[{
      "mark": "bar"},
    {
      "mark": {"type": "text", "color": "black", "xOffset": 8},
        "encoding": {
          "text": {"field": "Sum of PrimaryQuantityLoss", "type": "quantitative"}}
    }]
  ,

  "encoding": {
    "x": {
      "field": "Sum of PrimaryQuantityLoss",
      "type": "quantitative"
    },
    "y": {
      "field": "LossReason",
      "type": "ordinal"
    }
  }
}

huangapple
  • 本文由 发表于 2023年6月13日 17:57:59
  • 转载请务必保留本文链接:https://go.coder-hub.com/76463731.html
匿名

发表评论

匿名网友

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

确定