luong duyen
Thành viên chính thức


- Tham gia
- 26/5/08
- Bài viết
- 75
- Được thích
- 4
Chào mọi người,
Mình mới tập tành xài Query, cần đến đâu tìm đến đó nên cứ như cái nhà thủng lỗ, hôm nay là cái lỗ này
Làm sao để mình tách danh sách con xuống từng cột bên dưới ạ
Mình cảm ơn.
View attachment 280090
Thử code:đây bạn ơi, sơ xuất quên đính kèm file
let
Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
Group = Table.Group(Source, {"LEN"}, {{"Name code", each List.Distinct([Name code]), type table [LEN=nullable number, Name code=nullable text]}}),
Sort = Table.Sort(Group,{{"LEN", Order.Ascending}}),
List = Table.FromColumns(Sort[Name code],Sort[LEN])
in
List
hay ghê, cảm ơn bạn,Thử code:
Mã:let Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content], Group = Table.Group(Source, {"LEN"}, {{"Name code", each List.Distinct([Name code]), type table [LEN=nullable number, Name code=nullable text]}}), Sort = Table.Sort(Group,{{"LEN", Order.Ascending}}), List = Table.FromColumns(Sort[Name code],Sort[LEN]) in List
Ủa tưởng chủ đề đính kèm này không phải của bạn, té ra cũng của bạn, đề như vậy, có giải đáp rồi mà vẫn không ngộ ra được gì à?hay ghê, cảm ơn bạn,
Rất cảm ơn các bạn vẫn kiên nhẫn trả lời mình,Ủa tưởng chủ đề đính kèm này không phải của bạn, té ra cũng của bạn, đề như vậy, có giải đáp rồi mà vẫn không ngộ ra được gì à?
https://www.giaiphapexcel.com/diendan/threads/lọc-mã-theo-điều-kiện-và-đảm-bảo-mã-không-trùng-theo-điều-kiện-đó.161666/#post-1079795
Thử code:thêm 1 vấn đề phát sinh, có thể giúp mình luôn không, làm sao để mình sort các cột đó theo A-Z
let
Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
Group = Table.Group(Source, {"LEN"}, {{"Name code", each List.Distinct([Name code]), type table [LEN=nullable number, Name code=nullable text]}}),
Sort = Table.Sort(Group,{{"LEN", Order.Ascending}}),
L = Table.FromColumns(Sort[Name code],Sort[LEN]),
ColNames=Table.ColumnNames(L),
Res=Table.FromColumns(
List.Generate(()=>
[x=0,y=Table.Column(L,ColNames{x})],
each [x] < List.Count(ColNames),
each [x=[x]+1,y=Table.Column(L,ColNames{x})],
each List.Sort([y],(a,b)=>if a&b<> null then Value.Compare(a ,b) else Value.Compare(b ,a))),
ColNames)
in
Res
chèn ơi, xịn ghê, cảm ơn b nhiều, để mình nhai nuốt code. Cuối tuần vui vẻ nghen.Thử code:
Mã:let Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content], Group = Table.Group(Source, {"LEN"}, {{"Name code", each List.Distinct([Name code]), type table [LEN=nullable number, Name code=nullable text]}}), Sort = Table.Sort(Group,{{"LEN", Order.Ascending}}), L = Table.FromColumns(Sort[Name code],Sort[LEN]), ColNames=Table.ColumnNames(L), Res=Table.FromColumns( List.Generate(()=> [x=0,y=Table.Column(L,ColNames{x})], each [x] < List.Count(ColNames), each [x=[x]+1,y=Table.Column(L,ColNames{x})], each List.Sort([y],(a,b)=>if a&b<> null then Value.Compare(a ,b) else Value.Compare(b ,a))), ColNames) in Res