如何用Power BI矩阵中的零替换空白值?
我有一个以下格式的矩阵,在线和离线是措施。我想用零替换在线和离线的空白值。我该怎么做?
在线测量DAX(离线度量类似)
Online =
VAR sale =
CALCULATE(
SUM('Sales Data'[Sale Amount]),
FILTER(ALL('Sales Data'[Type of Sale]), 'Sales Data'[Type of Sale] = "Online")
)
VAR purch =
CALCULATE(
SUM('Sales Data'[Units Purchased]),
FILTER(ALL('Sales Data'[Type of Sale]), 'Sales Data'[Type of Sale] = "Online")
)
RETURN IF(SELECTEDVALUE(Labels[Metric]) = "Sales Amount", sale, purch)
I have a matrix in the below format, where Online and Offline are measures. I want to replace blank values for Online and Offline with zero. How can I do this?
Online measure DAX (similar for Offline measure)
Online =
VAR sale =
CALCULATE(
SUM('Sales Data'[Sale Amount]),
FILTER(ALL('Sales Data'[Type of Sale]), 'Sales Data'[Type of Sale] = "Online")
)
VAR purch =
CALCULATE(
SUM('Sales Data'[Units Purchased]),
FILTER(ALL('Sales Data'[Type of Sale]), 'Sales Data'[Type of Sale] = "Online")
)
RETURN IF(SELECTEDVALUE(Labels[Metric]) = "Sales Amount", sale, purch)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在您的措施中,您将需要将任何空白()结果专门设置为0。然后返回那些0而不是空白()。下面,我修改了您通过此调整提供的在线度量。
以下是我对此进行了测试的示例矩阵。
In your measures, you will want to specifically set any BLANK() results to 0. Then return those 0's instead of BLANK()'s. Below, I've modified the Online measure that you provided with this adjustment.
Below is a sample matrix that I tested this on.