Forum Discussion
ShashankRao99
3 years agoFrequent Visitor
Convert the SQL Query to M-Query for Data Flow.
We are new to Dataflow and M query. We are converting the SQL code to M query for Dataflows and we ran into a challenge. We have two tables, enrollment and Degrees and we are not able to convert ...
cassidy
Power Participant
3 years agoFirst off, Dataflows accept native SQL statements if that's easier for you to work with.
https://learn.microsoft.com/en-us/power-query/native-database-query
Purely M Query, which may be less efficient, would look like this I imagine:
Load Enrollment Enrl table
Load Degree Deg table
Merge Enrollment Enrl to Degree Deg on student_id
Expand degree_term
Add calculated column with your conditional statements where if all is True then "Keep"
Filter on calculated column for "Keep"
If you get it right, query folding will still be functioning and it will write back a query similar to what you started with.