Sign In Start Free Trial
Account

Add to playlist

Create a Playlist

Modal Close icon
You need to login to use this feature.
  • Book Overview & Buying Microsoft Power BI Cookbook
  • Table Of Contents Toc
  • Feedback & Rating feedback
Microsoft Power BI Cookbook

Microsoft Power BI Cookbook

By : Greg Deckler, Powell
4.8 (12)
close
close
Microsoft Power BI Cookbook

Microsoft Power BI Cookbook

4.8 (12)
By: Greg Deckler, Powell

Overview of this book

The complete everyday reference guide to Power BI, written by an internationally recognized Power BI expert duo, is back with a new and updated edition. Packed with revised practical recipes, Microsoft Power BI Cookbook, Second Edition, helps you navigate Power BI tools and advanced features. It also demonstrates the use of end-to-end solutions that integrate those features to get the most out of Power BI. With the help of the recipes in this book, you’ll gain advanced design and development insight, practical tips, and guidance on enhancing existing Power BI projects. The updated recipes will equip you with everything you need to know to implement evergreen frameworks that will stay relevant as Power BI updates. You’ll familiarize yourself with Power BI development tools and services by going deep into the data connectivity, transformation, modeling, visualization, and analytical capabilities of Power BI. By the end of this book, you’ll make the most of Power BI’s functional programming languages of DAX and M and deliver powerful solutions to common business intelligence challenges.
Table of Contents (16 chapters)
close
close
14
Other Book You May Enjoy
15
Index

Visualizing the M library

To implement complex and less common data transformation requirements, it is often necessary to browse the M library to find a specific function or review the parameters of a specific function.

This short recipe provides a pre-built M query expression you can use to retrieve the M library into a table for analysis in Power BI Desktop. Additionally, an example is provided of visualizing and cross-filtering this table of functions on the Power BI report canvas.

Getting ready

To get ready for this recipe, do the following:

  1. Open Power BI Desktop.
  2. Click the Transform data icon in the ribbon of the Home tab.
  3. Create a new Blank Query and call this query MLibrary.

How to Visualize M library

To implement this recipe, perform the following steps:

  1. Enter the following M code in the Advanced Editor:
    let
        Source = Record.ToTable(#shared),
        Rename = Table.RenameColumns(Source, {{"Name", "Function"}}),
        Sort = Table.Sort(Rename, {{"Function", Order.Ascending}}),
        Dupe = Table.DuplicateColumn(Sort, "Function", "Function2"),
        Split = 
            Table.SplitColumn(
                Dupe, "Function2",
                Splitter.SplitTextByDelimiter(".", QuoteStyle.Csv),
                {"Group", "Detail"}
            ),
        MLibraryTable = 
            Table.TransformColumnTypes(
                Split, {{"Group", Text.Type}, {"Detail", Text.Type}}
            )
    in
        MLibraryTable
    
  2. Click the OK button to close the Advanced Editor. The preview area should now look similar to that shown in Figure 2.41.

    Figure 2.41: Query Editor view of library table function

  3. Click on Close and Apply from the Query Editor.
  4. The 1,000+ rows from the M library are now loaded to the Data mode.
  5. Create a visualization that uses the Function Groups column for filtering.

Figure 2.42: Report page of M standard library

How it works

The M expression leverages the #shared variable, which returns a record of the names and values currently in scope. The record is converted to a table value and then the Function column, originally Name in the context of the library, is split based on the period delimiter to allow for the Group column.

There's more...

M library details for every function are made available by entering the function without any parameters.

Figure 2.43: Library Function Details

See also

Create a Note

Modal Close icon
You need to login to use this feature.
notes
bookmark search playlist download font-size

Change the font size

margin-width

Change margin width

day-mode

Change background colour

Close icon Search
Country selected

Close icon Your notes and bookmarks

Delete Bookmark

Modal Close icon
Are you sure you want to delete it?
Cancel
Yes, Delete

Delete Note

Modal Close icon
Are you sure you want to delete it?
Cancel
Yes, Delete

Edit Note

Modal Close icon
Write a note (max 255 characters)
Cancel
Update Note

Confirmation

Modal Close icon
claim successful

Buy this book with your credits?

Modal Close icon
Are you sure you want to buy this book with one of your credits?
Close
YES, BUY