Check your eligibility for this 50% exam voucher offer and join us for free live learning sessions to get prepared for Exam DP-700.
Get StartedDon't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.
Hello,
I am struggling to get two folders imported which contain different types of CSVs.
When I add the second folder as source, the query editor shows the helper queries from the first folder and when I modify them, the first folders data gets messed up.
Here is, how my query editor looks like as an image.
I'd need a new "Transform File" and "Transform Sample File" function for the second folder but I don't know how to create it.
Can anyone point me in the right direction?
Zap.
Solved! Go to Solution.
the helper functions are very nice when you are new to Power Query and the M language. Once your knowledge has increased you will find that they are rather ineffective and that they can be simplified a lot, and even can be eliminated in some cases.
Two options:
1. rename your existing helper function components for the first folder before creating the query for the second folder.
2. Create a M function that does everything the helper functions do, but in a more elegant way.
Example for 2:
(Parameter) => let
Source = Csv.Document(Parameter,[Delimiter=",", Encoding=65001, QuoteStyle=QuoteStyle.Csv]),
#"Promoted Headers" = Table.PromoteHeaders(Source, [PromoteAllScalars=true]),
Selected = Table.SelectColumns(#"Promoted Headers",Columns)
in
Selected
(Note: "Columns" is a list of desired column - this is done to filter the source files early, and to avoid having to load the "Sample File" twice like the helper function does)
You should be able to use the Get Data > From Folder twice, and point to the two different folders, then do an append to combine them once they're both in the same format.
Otherwise see if this exercise helps you understand the helper queries a bit better:
Use Parameters to Combine Data
Copying DAX from this post? Click here for a hack to quickly replace it with your own table names
Has this post solved your problem? Please Accept as Solution so that others can find it quickly and to let the community know your problem has been solved.
If you found this post helpful, please give Kudos C
I work as a Microsoft trainer and consultant, specialising in Power BI and Power Query.
www.excelwithallison.com
the helper functions are very nice when you are new to Power Query and the M language. Once your knowledge has increased you will find that they are rather ineffective and that they can be simplified a lot, and even can be eliminated in some cases.
Two options:
1. rename your existing helper function components for the first folder before creating the query for the second folder.
2. Create a M function that does everything the helper functions do, but in a more elegant way.
Example for 2:
(Parameter) => let
Source = Csv.Document(Parameter,[Delimiter=",", Encoding=65001, QuoteStyle=QuoteStyle.Csv]),
#"Promoted Headers" = Table.PromoteHeaders(Source, [PromoteAllScalars=true]),
Selected = Table.SelectColumns(#"Promoted Headers",Columns)
in
Selected
(Note: "Columns" is a list of desired column - this is done to filter the source files early, and to avoid having to load the "Sample File" twice like the helper function does)
Thank you for your answer! I used the option to rename the functions which I didnt think of before (obviously) and afterwards it was pretty simple to add my second data source!
Zap.
User | Count |
---|---|
123 | |
77 | |
62 | |
50 | |
48 |
User | Count |
---|---|
175 | |
125 | |
61 | |
60 | |
58 |