|
- let
- 源 = Excel.CurrentWorkbook(){[Name="表1"]}[Content],
- 逆透视的其他列 = Table.UnpivotOtherColumns(Table.Skip(源,1), {"时间"}, "名称", "值"),
- 自定义1 =
- Table.Group(
- 逆透视的其他列,
- "名称",
- {
- "q",
- each
- let
- f =
- (d)=>
- let
- l =
- Table.ToColumns( Table.Range( _, d{0}, d{1} ) ),
- r =
- { l{1}{0}, Text.Format( "#{0}-#{1}", { l{2}{0}, List.Last( l{2} ) } ) } &
- (
- let
- t = List.Transform( { l{0}{0}, List.Last( l{0} ) }, (x)=> Time.From( DateTime.From( x ) ) )
- in
- { Text.Format( "#{0}-#{1}", t ), Duration.TotalMinutes( t{1} - t{0} ) }
- )
-
- in
- r
- in
- List.Transform( { {0,14}, {13,19}, {32,null} }, (x)=> f(x) )
- }
- )[q],
- 自定义2 =
- Table.FromRows( List.Combine( 自定义1 ) )
- in
- 自定义2
复制代码 |
|