本节跟大家分享一个经验,函数Table.FillDown的使用。
格式:
Table.FillDown(table as table, columns as list) as table
Returns a table from the table specified where the value of a previous cell is propagated to the null-valued cells below in the columnsspecified.
例子:
Return a table with the null values in column [Place] filled with the value above them from the table.
Table.FillDown(Table.FromRecords({[Place=1, Name=”Bob”], [Place=null, Name=”John”], [Place=2, Name=”Brad”], [Place=3, Name=”Mark”], [Place=null, Name=”Tom”], [Place=null, Name=”Adam”]}), {“Place”})
下面我们看一个例子,比如学生成绩大于等于60的显示合格,否则显示空(用条件列判断)。
此时使用向下填充没有问题。
若更改条件公式。
Table.AddColumn(更改的类型, “Custom”, each if [成绩] >= 60 then “合格” else null )
Table.AddColumn(更改的类型, “Custom”, each if [成绩] >= 60 then “合格” else “”)
这个时候再向下填充是不起作用的。
满足FillDown的条件是要填充的单元格必须是null值,不是””。
例子没有任何意义,仅作说明,勿要见怪。