如果其他措施不返回0

发布于 2025-01-30 09:10:15 字数 1721 浏览 4 评论 0 原文

再会!

这是我的代码标准,对于突出显示的行,如果有值,它将计算ETD和ATD,但是由于没有值,它将返回0%和0%的计算。

这是我的措施,

CountNotBlank = 
SUMX(
ADDCOLUMNS(
RawDatas,
"Count",
var Direction = RawDatas[Direction]
var Dep = RawDatas[Dep]
var res1 = COUNTROWS(
FILTER(
 {RawDatas[ETD],RawDatas[ATD],RawDatas[ETA],RawDatas[ATA],RawDatas[Estimated Delivery],RawDatas[Actual Delivery]},
NOT ISBLANK([Value])))
var res2 = COUNTROWS(
FILTER(
 {RawDatas[ETA],RawDatas[ATA],RawDatas[Estimated Delivery],RawDatas[Actual Delivery]},
NOT ISBLANK([Value])) )
var res3 = COUNTROWS(
filter(
 {RawDatas[ETD] , RawDatas[ATD]},
NOT ISBLANK([Value]) ))
var res4 = COUNTROWS(
FILTER(
 {RawDatas[ETA],RawDatas[ATA]},
NOT ISBLANK([Value])))
return
if (Direction = "Export" && LEFT(Dep, 1) = "D", res2 , 
if (Direction = "Export" && NOT(LEFT(Dep, 1) = "D") , res1,
if (Direction = "Import" , res3,
if (Direction = "Domestic" , res4,
0))))),
[Count])

如果没有满足条件,我尝试返回0,但似乎不起作用。我想念什么吗?

期望

任何帮助都会非常感谢。

附带PBIX:

Good Day!
enter image description here

This is my code criteria, for the highlighted row, it will count ETD and ATD if there is value, but since there is none, it will return 0 and 0% for the calculation.

This is my measure,

CountNotBlank = 
SUMX(
ADDCOLUMNS(
RawDatas,
"Count",
var Direction = RawDatas[Direction]
var Dep = RawDatas[Dep]
var res1 = COUNTROWS(
FILTER(
 {RawDatas[ETD],RawDatas[ATD],RawDatas[ETA],RawDatas[ATA],RawDatas[Estimated Delivery],RawDatas[Actual Delivery]},
NOT ISBLANK([Value])))
var res2 = COUNTROWS(
FILTER(
 {RawDatas[ETA],RawDatas[ATA],RawDatas[Estimated Delivery],RawDatas[Actual Delivery]},
NOT ISBLANK([Value])) )
var res3 = COUNTROWS(
filter(
 {RawDatas[ETD] , RawDatas[ATD]},
NOT ISBLANK([Value]) ))
var res4 = COUNTROWS(
FILTER(
 {RawDatas[ETA],RawDatas[ATA]},
NOT ISBLANK([Value])))
return
if (Direction = "Export" && LEFT(Dep, 1) = "D", res2 , 
if (Direction = "Export" && NOT(LEFT(Dep, 1) = "D") , res1,
if (Direction = "Import" , res3,
if (Direction = "Domestic" , res4,
0))))),
[Count])

I tried returning 0 if a condition isn't met, but it doesn't seem to work. Is there anything I missed?
enter image description here

Expectation
enter image description here

Any help will greatly appreciated.

Attached with the pbix: https://drive.google.com/file/d/1aHV6qz66yPMbqR34EdCEGd3UPK_lsStv/view?usp=sharing

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

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

发布评论

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

评论(1

做个少女永远怀春 2025-02-06 09:10:15

如果(ISBlank(... :

CountNotBlank = 
VAR notblankvar = 
//your code from above not pasted here for readability//
RETURN IF(ISBLANK(notblankvar),0,notblankvar)

让我知道我的 .pbix file file files,我可以帮助我是否有帮助。

I was able to produce your expected result by nesting the whole expression inside IF(ISBLANK(...:

CountNotBlank = 
VAR notblankvar = 
//your code from above not pasted here for readability//
RETURN IF(ISBLANK(notblankvar),0,notblankvar)

Let me know if it would be helpful to see my .pbix file.

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