Forum Discussion
Stuck in PQ and not sure how to achieve next steps
Thank you so much! this really helps!
Two questions:
1) How do I stack each column onto each other/transpose the list? For example:
Employee Amount Month
Employee 1 x 1
Employee 2 x 1
Employee 3 x 1
Employee 1 x 2
Employee 2 x 2
Employee 3 x 2
Employee 1 x 3
Employee 2 x 3
Employee 3 x 3
2) Are there any resources/M Code resources where there already made/examples of Excel funtions? For example M Code equivalent of:
=IFS
=IFS
=UNIQUE(FILTER(
=LEFT(SEARCH(
=XLOOKUP(
=A1=B1 (to return Boolean T or F for data checks)
=WEEKNUM
=IF(AND(
Thank you again so much!
JKPieterse could correct me, my variant
1) Table Transform - remove Employee and Account # columns, select Name, unpivot other columns, Group By Name and Month. Please see in attached.
2) I strongly recommend not to map Excel formulas into Power Query, that's ineffective approach. Think in terms of records and lists (aka rows and columns), not in terms of cells and their values. Merging, grouping, pivoting/unpivoting are usually used. As for date/text/numbers transformation check Transform tab from left to right, majority of the are here.
3) It's always better to attach the file, scripts within posts are more for other people who will check for similar solutions.
- Jpalaci1Jan 17, 2021Brass Contributor
Last question. When I get my data it comes as a whole new data set. I don't just append the latest months as the new month's file can have corrections for the previous months. Should I put into a folder the raw data and when I get the latest take out last month's and replace the newest in the folder? Should I just do a new query using by pasting the M Code every month a new file comes in?
Thank you so much for the help!
- SergeiBaklanJan 17, 2021Diamond Contributor
If all these files have the same structure, you may collect them in some folder and use From Folder connector to transform all files at once. To keep only latest figures, on final step sort result by name and month and remove duplicates.
Ideal situation if you build this reporting system and forget about it for years. For example, Flow drops attachments from emails into the folder upon receiving; power query in background performs scheduled refreshes and returns result to publish it on web or in another Excel.