RE
Cela marche aussi et tu peux gagner 2 étapes
let
Source = Excel.CurrentWorkbook(){[Name="Tableau1"]}[Content],
#"Index ajouté" = Table.AddIndexColumn(Source, "Index", 1, 1, Int64.Type),
#"Requête ajoutée" = Table.Combine({#"Index ajouté", #"Index ajouté"}),
#"Lignes triées" = Table.Sort(#"Requête ajoutée",{{"Index", Order.Ascending}}),
#"Index ajouté1" = Table.AddIndexColumn(#"Lignes triées", "Index.1", 1, 1, Int64.Type),
#"Élément sélectionné est pair" = Table.TransformColumns(#"Index ajouté1",{{"Index.1", Number.IsEven, type logical}}),
#"Colonne conditionnelle ajoutée" = Table.AddColumn(#"Élément sélectionné est pair", "COMPTE", each if [Index.1] = false then [COMPTE DEBIT] else [COMPTE CREDIT]),
#"Colonne conditionnelle ajoutée1" = Table.AddColumn(#"Colonne conditionnelle ajoutée", "MONTANT DEBIT", each if [Index.1] = false then [MONTANT] else " "),
#"Colonne conditionnelle ajoutée2" = Table.AddColumn(#"Colonne conditionnelle ajoutée1", "MONTANT CREDIT", each if [Index.1] = true then [MONTANT] else " "),
#"Autres colonnes supprimées" = Table.SelectColumns(#"Colonne conditionnelle ajoutée2",{"COMPTE", "MONTANT DEBIT", "MONTANT CREDIT"})
in
#"Autres colonnes supprimées"