Shared Keyword

#shared


Say (say, say), say the magic word

SHARED  - S.H.A.R.E.D. 


In Power BI, there is Power Query M which is functional language. Knowing as many as possible functions you can, it's the best assistant when you have to do something writing M language.

In this post we will talk about the shared keyword. There are many times that you need to go the manual of M language  and search for the syntax of a function. 


👉What if you have the entire manual in a single query, inside the Power BI in order to read the syntax and test the function ?


  • Open Power Query editor, go to New Source and choose Blank Query.











  • Then go to query, right-click and choose Advanced Editor.

         At the advanced editor pane, delete all content here and only type in: #sharedand then press done.













  • The result set here is a query that has functions, enumerators, and queries in each item of the record. 

        Go to Convert tab and choose Into TableThis will convert result set record to a table and table is really easy to search in as you know.
















  • Now, you have all the manual in the form of table and it's very simple to search for a certain  function and test it before you use it.
          Go to the first column of the table "Name", choose the down arrow next to it, go to search and type in a word which is contained in the function name.

          Let's try to find out, all the functions with the week.















































  • After the search the result is the following:





















  • If you want to see the syntax of a function ,  go to the desired row,  choose the cell of "Value" column . The result is the following:
























  • Now if you want to test the function Date.WeekOfYear, go to the function value on "Value" column, right click and then choose Add as new Query.

         Eventually, you have a new query, which contain all the manual for the chosen function and it also contains the Enter Parameters field, where you can test the function and see the result.















In this post, you've learned how helpful  #shared keyword  is.
This tip is superb, especially for people who can’t remember things well and they also want to test something before they use it.





Σχόλια

Δημοφιλείς αναρτήσεις από αυτό το ιστολόγιο

Calendar table on Vertica DB