Forum Discussion
Artefx
10 years agoRegular Visitor
Converting from SQL to M
Hi, I am attempting to recreate a SQL query I have into M format so I can turn it into a function within PowerBI, but i'm having a little trouble. WITH RPL (PART, SUBPART, QUANTITY) AS
(
SEL...
- 10 years ago
my way of doing this (probably others) is to
1. drop the SQL in as normal,
2. edit query,
3. right click table in lefthand pane in query editor,
4. select advanced editor. you will then see the m version of your SQL.
sulli01
7 years agoFrequent Visitor
I think this post answers your question perfectly: https://blog.crossjoin.co.uk/2017/06/11/query-folding-and-writing-your-own-sql-queries-in-power-querypower-biexcel-get-transform/
ImkeF
7 years agoCommunity Champion
If your source data sits in the SQL-server, the fastest solution will be to use the SQL-code as it is like Artefx has described.
But if it doesn't, you can check out my M-solution for it here: https://www.thebiccountant.com/2017/05/08/dynamic-bill-of-material-bom-solution-in-excel-and-powerbi/