Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Power Query Cookbook

You're reading from   Power Query Cookbook Use effective and powerful queries in Power BI Desktop and Dataflows to prepare and transform your data

Arrow left icon
Product type Paperback
Published in Oct 2021
Publisher Packt
ISBN-13 9781800569485
Length 412 pages
Edition 1st Edition
Languages
Arrow right icon
Author (1):
Arrow left icon
Andrea Janicijevic Andrea Janicijevic
Author Profile Icon Andrea Janicijevic
Andrea Janicijevic
Arrow right icon
View More author details
Toc

Table of Contents (12) Chapters Close

Preface 1. Chapter 1: Getting Started with Power Query 2. Chapter 2: Connecting to Fetch Data FREE CHAPTER 3. Chapter 3: Data Exploration in Power Query 4. Chapter 4: Reshaping Your Data 5. Chapter 5: Combining Queries for Efficiency 6. Chapter 6: Optimizing Power Query Performance 7. Chapter 7: Leveraging the M Language 8. Chapter 8: Adding Value to Your Data 9. Chapter 9: Performance Tuning with Power BI Dataflows 10. Chapter 10: Implementing Query Diagnostics 11. Other Books You May Enjoy

Creating tables in M

Thanks to M language, you can create complex tables from scratch without necessarily defining them inside an external data source and then importing them in Power Query. One common example is the definition of a list of dates that can then be customized.

Getting ready

In this recipe, you only need to have Power BI Desktop running on your PC.

How to do it…

Once you open your Power BI Desktop application, you are ready to perform the following steps:

  1. Click on Get Data and select the Blank query connector.
  2. The Power Query UI will pop up and you will see an empty query with its default name as Query1:

    Figure 7.48 – Blank query

  3. Browse to the Home tab and click on Advanced Editor.

    We want to create a list of dates that starts at 01/01/2011 and ends on the current date. In order to define this logic, we have to use the List.Dates expression and its syntax is as follows:

    List.Dates(start as date, count as number, step as duration...
lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Banner background image