再会!
请求
以下是我的原始数据,并应用了一些条件以检查需要计算哪些列。
示例:
- 第1行,方向是导出,部门代码没有以“ D”开头
将计算所有6列(ETD,ATD,ETA,ATA,估计的Delivey,
实际交货),只填充了5个,因此获得83个
百分比。
- 第2行,方向是出口,部门代码开始
使用“ D”,只会计算4列(ETA,ATA,估计的交付
和实际交付),只填充了2个,因此获得50%。
我现在拥有的:
我有一个代码,但它仅显示所有列,并且填充了哪个列,我希望在计算上述条件方面有所帮助。
dax :(计算不是空白)
Count =
SUMX(
ADDCOLUMNS(
RawData,
"Count",
var tab = {RawData[ETD],RawData[ATD],RawData[ETA],RawData[ATA],RawData[Estimated Delivery],RawData[Actual Delivery]}
var result =
COUNTROWS(
FILTER(
tab,
[Value]<>BLANK()))
return
IF(
ISBLANK(result),
0,
result
) ),[Count])
dax:计算空白
Count =
SUMX(
ADDCOLUMNS(
RawData,
"Count",
var tab = {RawData[ETD],RawData[ATD],RawData[ETA],RawData[ATA],RawData[Estimated Delivery],RawData[Actual Delivery]}
var result =
COUNTROWS(
FILTER(
tab,
[Value]=BLANK()))
return
IF(
ISBLANK(result),
0,
result
) ),[Count])
将不胜感激。
与我的pbix相连:
谢谢!
Good Day!
Request

The following is my raw data, with some conditions applied to check which columns need to be counted.
Example:
- Row 1, direction is export, department code is not starting with 'D',
will count all 6 columns (ETD, ATD,ETA, ATA, Estimated Delivey,
Actual Delivery) , and only 5 have been filled in, so get 83 as the
percentage.
- Row 2, direction is export, department code starting
with 'D', will only count 4 columns (ETA, ATA,Estimated Delivery
and Actual Delivery), and only 2 has been filled in, so get 50%.
What I have now:

I have a code but it only shows all columns and which column has been filled, and I would like some help in calculating the conditions as stated above.
DAX: (calculate not blank)
Count =
SUMX(
ADDCOLUMNS(
RawData,
"Count",
var tab = {RawData[ETD],RawData[ATD],RawData[ETA],RawData[ATA],RawData[Estimated Delivery],RawData[Actual Delivery]}
var result =
COUNTROWS(
FILTER(
tab,
[Value]<>BLANK()))
return
IF(
ISBLANK(result),
0,
result
) ),[Count])
DAX: Calculate blank
Count =
SUMX(
ADDCOLUMNS(
RawData,
"Count",
var tab = {RawData[ETD],RawData[ATD],RawData[ETA],RawData[ATA],RawData[Estimated Delivery],RawData[Actual Delivery]}
var result =
COUNTROWS(
FILTER(
tab,
[Value]=BLANK()))
return
IF(
ISBLANK(result),
0,
result
) ),[Count])
Any help will be greatly appreciated.
Attached here with my pbix: https://drive.google.com/file/d/1KIROrAzNEp710JEfxMfiZLzvTpuHj3OZ/view?usp=sharing
Thank you!
发布评论
评论(1)
对于计数,我添加了“ D”的决策;
我还遵循您的逻辑进行计数量度:
然后,我添加了度量%
结果:
我相信您会更好地使用计算的列,但没有像您选择的措施那样去做。
如果我会从头开始,我将使用一个Undivot表中的Power查询,这使编码更加动态
For the count I added the decision making of the "D";
I also followed your logic to go with the Counts measure:
Then I added the measure %
Result:

I do believe you would be better of using calculated columns but did not go their as you had choosen measures already.
IF I would have started from scratch, I would have gone with an unpivot table in power query what makes the coding more dynamic