[英]Power BI: Calculated column or Measure
I have following data: 我有以下数据:
Table : PriceTable 表 :价格表
Price Applicable1 Applicable2 Percentage
--------------------------------------------
100 Yes Yes 0.10
200 Yes No 0.50
300 No Yes 0.30
500 Yes Yes 0.40
I want to calculate the Percentage of price in last column and show in the table/matrix in the power bi report. 我想计算最后一列中的价格百分比,并在power bi报表的表/矩阵中显示。
Scenario : If both column Applicable1 and Applicable2
are equal to Yes
then calculate the percentage of price in the final column. 方案 :如果
Applicable1 and Applicable2
列均等于Yes
则计算最后一列中的价格百分比。
My try : I have taken New Column
and added following DAX : 我的尝试 :我选了
New Column
并添加了以下DAX :
Commission = IF( PriceTable[Applicable1] = "Yes" &&
PriceTable[Applicable2] = "Yes",
PriceTable[Price] * PriceTable[Percentage], 0)
Question : 问题 :
- Which one should I use
New Column
ORMeasure
?我应该使用“
New Column
或“Measure
?- If
Measure
, then how to calculate the same?如果是
Measure
,那么该如何计算呢?
Use new Column as you calculation is not dynamic it's row wise calculation so use NewColumn. 使用new Column是因为您的计算不是动态的,它是逐行计算,因此请使用NewColumn。 Even it's fast as It's precalculated If you use dynamic it calculates the value every time when you launch the report which slow down your report loading
甚至快速,因为它是预先计算的如果您使用动态功能,则每次启动报告时都会计算值,这会减慢报告的加载速度
Rob Collie has an excellent blog post on " When to Use Measures vs. Calc Columns " 罗布·科利(Rob Collie)在“ 何时使用度量与计算列 ”上发表了一篇很棒的博客文章。
And Reza Rad has another good post: Reza Rad还有另一个好帖子:
Measure vs Calculated Column: The Mysterious Question? 测量列与计算列:神秘的问题? Not!
不!
My favourite take-away from this is: 我最喜欢的外卖点是:
If you want to put it on rows, columns, slicers, or report filters, it MUST be a column
如果要将其放在行,列,切片器或报表过滤器上,则必须为列
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.