+ Reply to Thread
Results 1 to 8 of 8

SQL -> Power Query SQL

  1. #1
    Registered User
    Join Date
    08-30-2016
    Location
    Edmonton, Canada
    MS-Off Ver
    2016 64b
    Posts
    92

    SQL -> Power Query SQL

    What is the primary difference between SQL and Power Query SQL?

    I ask because I'm trying to build a query using Power Query that mirrors something like this SQL query:

    Declar3 @DateValue DateTime = '3/1/2010'

    s3l3ct DATEADD (D, -1 * DatePart (DW, @DateValue) + 7, @DateValue)


    The problem is, Power Query in Excel is incredibly contained and I don't see any guides to learn the logic.

    Help is appreciated.

  2. #2
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: SQL -> Power Query SQL

    SQL is the standard language and all the major companies implemented their modified versions of SQL. TSQL is Microsoft's version of SQL and PSQL for Oracle.
    I have not used Power Query SQL, but the syntax resembles TSQL

  3. #3
    Forum Expert CK76's Avatar
    Join Date
    06-16-2015
    Location
    ONT, Canada
    MS-Off Ver
    MS365 Apps for enterprise
    Posts
    5,887

    Re: SQL -> Power Query SQL

    PowerQuery uses functions called "M" to work with data. See link for details.
    https://msdn.microsoft.com/en-us/library/mt211003.aspx

    PowerQuery also has tool to connect to SQL Server and use native SQL Query to bring in data.
    0.JPG

  4. #4
    Registered User
    Join Date
    08-30-2016
    Location
    Edmonton, Canada
    MS-Off Ver
    2016 64b
    Posts
    92

    Re: SQL -> Power Query SQL

    Is there any guide available to walkthrough the powerquery set-up for enabling SQL override of M?

  5. #5
    Forum Guru xlnitwit's Avatar
    Join Date
    06-27-2016
    Location
    London
    MS-Off Ver
    Windows: 2010; Mac: 16.13 (O365)
    Posts
    7,085

    Re: SQL -> Power Query SQL

    SQL is for getting data into Power Query; M is for manipulating the data once it is in Power Query. It is not one or the other.
    Don
    Please remember to mark your thread 'Solved' when appropriate.

  6. #6
    Forum Expert CK76's Avatar
    Join Date
    06-16-2015
    Location
    ONT, Canada
    MS-Off Ver
    MS365 Apps for enterprise
    Posts
    5,887

    Re: SQL -> Power Query SQL

    I'm not sure I get you.

    What you can do, as long as you have access to SQL database...
    Get&Transform->FromDatabase->From SQL Server database

    Then expand "Advanced options". You can write SQL query there. However, do note that this is only for initially bringing in the data.

    Subsequent transformation need "M".

    With your example. You can do something like below in advanced editor using "M" as well.

    1.JPG

    Result:
    0.JPG

  7. #7
    Registered User
    Join Date
    08-30-2016
    Location
    Edmonton, Canada
    MS-Off Ver
    2016 64b
    Posts
    92

    Re: SQL -> Power Query SQL

    I could have misinterpreted the response; my impression was there being a 'switch' that would enable SQL to substitute M when writing queries in Power Query.

    So, if this is not the case, is there a good resource to learn M in an efficient way?
    - logic
    - parameters of each statement and why one is required over the other: "()" vs "[]" vs "{}" and "#"
    - the order

  8. #8
    Forum Expert CK76's Avatar
    Join Date
    06-16-2015
    Location
    ONT, Canada
    MS-Off Ver
    MS365 Apps for enterprise
    Posts
    5,887

    Re: SQL -> Power Query SQL

    ...there being a 'switch' that would enable SQL to substitute M...
    No, there isn't such functionality. SQL is for bringing in data into PowerQuery. Once data is brought in, you manipulate using "M".

    As for resource for learning... try links below. Personally, I learned from trial and error, along with web search for specific things I got stuck on.

    https://www.simple-talk.com/sql/repo...er-bi-desktop/
    https://blog.crossjoin.co.uk/ (Chris Webb's blog, his book is great resource as well I hear. Though I don't own one)


    Also, PowerBI community is a great resource.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. error in power query & power pivot
    By Baldev Kumar in forum Excel Charting & Pivots
    Replies: 8
    Last Post: 01-03-2018, 01:34 AM
  2. Power Query From Within VBA
    By rabend in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 09-18-2016, 07:34 AM
  3. [SOLVED] power query
    By juanda92 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-12-2016, 08:56 AM
  4. is it possible to incorporate VBA into Power Query ?
    By Hassan1977 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 07-10-2016, 05:33 AM
  5. VBA and Power Query
    By Brawnystaff in forum Excel Programming / VBA / Macros
    Replies: 16
    Last Post: 05-16-2015, 05:10 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1