In Power BI Desktop, the M code for each query can be accessed from the Advanced Editor window within the Power Query Editor. With the Power Query Editor open, select a query of interest from the list of queries on the left and click on the Advanced Editor icon from the Home tab to access the following window:
As of the October 2017 release of Power BI Desktop, the Advanced Editor is limited to checking the syntax of the query. The colorization or highlighting of keywords, surrounding detection, and IntelliSense features available to DAX expressions is not yet available in Power BI Desktop. ...