Forum Discussion
Reference two or more Columns as Source in new query
- 8 years ago
I speak from personal experience - if there is difference in performance I don't think it will be visible in most cases
I do prefer the clarity of the code in my syntax, it's quite straightforward so in case you need to handover it shouldn't be too complex
as for learning you can give this a go
https://msdn.microsoft.com/en-us/query-bi/m/power-query-m-language-specificationa bit tough read, but gives much better understanding of M
EDIT
you can even simplify it morelet Source = Table.SelectColumns(Tbl_CoursesbyTutorTable,{"Course Codes", "Course Title"}) in Sourcebut I actually prefer to have the steps separated
Hi Stachu,
Thank you for sharing. Happy to go with your suggestion, if there is a reason why it is a better approach e.g. speed of processing, best practice, your experience etc.
Could you elaborate, so this post acts as a learning tool also? Any blogs mentioning the topics would also be fab.
I speak from personal experience - if there is difference in performance I don't think it will be visible in most cases
I do prefer the clarity of the code in my syntax, it's quite straightforward so in case you need to handover it shouldn't be too complex
as for learning you can give this a go
https://msdn.microsoft.com/en-us/query-bi/m/power-query-m-language-specification
a bit tough read, but gives much better understanding of M
EDIT
you can even simplify it more
let
Source = Table.SelectColumns(Tbl_CoursesbyTutorTable,{"Course Codes", "Course Title"})
in
Sourcebut I actually prefer to have the steps separated
- Josh_BI_UK8 years ago
Helper II
Thank you Stachu , this works like a charm. I tried to apply the "{ }" curly brackets methodology, before your post but got the syntax wrong. Thank you, your code clears it up for me.:smileyhappy:
- Stachu8 years ago
Community Champion
{} is the syntax for list e.g. {1..10} creates list from 1 to 10, while {"a","x","c"} is just hardcoded one
in the syntax i posted, if one of the preceding steps would contain the column names you could reference that list in Table.SelectColumns
I use it sometimes for dynamic column selection