Forum Discussion
Automate creating new queries ...
- 1 year ago
Bonjour adambc
Je réponds en français, c'est plus simple pour moi
C'est possible avec une requête Power Query chargée dans le modèle de données (Power Pivot) et une petite macro VBA pour modifier chaque table en DAXLa requête Power Query doit regrouper vos 78 fichiers et la macro va filtrer sur le nom de chaque fichier
A adapter bien évidemment
code de la macro
Sub Duplique()
For Each Nom In Range("Tableau1[Column1]")
Sheets.Add After:=ActiveSheet
ActiveSheet.Name = Nom
Set Data = ActiveSheet.ListObjects.Add(SourceType:=4, Source:=ActiveWorkbook.Connections("Requête - Tableau1"), Destination:=Range("$A$1"))
Data.TableObject.WorkbookConnection.OLEDBConnection.CommandText = Array("EVALUATE FILTER(Tableau1, [Column1]=""" & Nom & """)")
Data.TableObject.WorkbookConnection.OLEDBConnection.CommandType = xlCmdDAX
Data.Refresh
Next Nom
End SubVoir la vidéo en pièce jointe
Stéphane
Only have 365 Business and therefore don't have the SP Folder connector!
Not sure I understand the PQ function well enough - any pointers to resources I could study?
And I don't want to combine - I want 78 Worksheets with 78 Tables!
Thanks anyway ...
Are you sure you want 78 queries?
Consider using VBA (as you mentioned) to construct the PBIR format or the raw .pq format