A
- AccessControlEntry.ConditionToIdentities
- Access.Database
- ActiveDirectory.Domains
- AdobeAnalytics.Cubes
- AdoDotNet.DataSource
- AdoDotNet.Query
- AnalysisServices.Database
- AnalysisServices.Databases
- AzureStorage.BlobContents
- AzureStorage.Blobs
- AzureStorage.DataLake
- AzureStorage.DataLakeContents
- AzureStorage.Tables
B
- BinaryFormat.Binary
- BinaryFormat.Byte
- BinaryFormat.ByteOrder
- BinaryFormat.Choice
- BinaryFormat.Decimal
- BinaryFormat.Double
- BinaryFormat.Group
- BinaryFormat.Length
- BinaryFormat.List
- BinaryFormat.Null
- BinaryFormat.Record
- BinaryFormat.SignedInteger16
- BinaryFormat.SignedInteger32
- BinaryFormat.SignedInteger64
- BinaryFormat.Single
- BinaryFormat.Text
- BinaryFormat.Transform
- BinaryFormat.UnsignedInteger16
- BinaryFormat.UnsignedInteger32
- BinaryFormat.UnsignedInteger64
- BinaryFormat.7BitEncodedSignedInteger
- BinaryFormat.7BitEncodedUnsignedInteger
- Binary data
- Binary.ApproximateLength
- Binary.Buffer
- Binary.Combine
- Binary.Compress
- Binary.Decompress
- Binary.From
- Binary.FromList
- Binary.FromText
- Binary.InferContentType
- Binary.Length
- Binary.Range
- Binary.Split
- Binary.ToList
- Binary.ToText
- Binary.View
- Binary.ViewError
- Binary.ViewFunction
- Byte.From
C
- Cdm.Contents
- Character.FromNumber
- Character.ToNumber
- Combiner.CombineTextByDelimiter
- Combiner.CombineTextByEachDelimiter
- Combiner.CombineTextByLengths
- Combiner.CombineTextByPositions
- Combiner.CombineTextByRanges
- Comparer.FromCulture
- Comparer.Ordinal
- Comparer.OrdinalIgnoreCase
- Controlling byte order
- Csv.Document
- Cube.AddAndExpandDimensionColumn
- Cube.AddMeasureColumn
- Cube.ApplyParameter
- Cube.AttributeMemberId
- Cube.AttributeMemberProperty
- Cube.CollapseAndRemoveColumns
- Cube.Dimensions
- Cube.DisplayFolders
- Cube.MeasureProperties
- Cube.MeasureProperty
- Cube.Measures
- Cube.Parameters
- Cube.Properties
- Cube.PropertyKey
- Cube.ReplaceDimensions
- Cube.Transform
- Currency.From
D
- DateTime.AddZone
- DateTime.Date
- DateTime.FixedLocalNow
- DateTime.From
- DateTime.FromFileTime
- DateTime.FromText
- DateTime.IsInCurrentHour
- DateTime.IsInCurrentMinute
- DateTime.IsInCurrentSecond
- DateTime.IsInNextHour
- DateTime.IsInNextMinute
- DateTime.IsInNextNHours
- DateTime.IsInNextNMinutes
- DateTime.IsInNextNSeconds
- DateTime.IsInNextSecond
- DateTime.IsInPreviousHour
- DateTime.IsInPreviousMinute
- DateTime.IsInPreviousNHours
- DateTime.IsInPreviousNMinutes
- DateTime.IsInPreviousNSeconds
- DateTime.IsInPreviousSecond
- DateTime.LocalNow
- DateTime.Time
- DateTime.ToRecord
- DateTime.ToText
- Date.AddDays
- Date.AddMonths
- Date.AddQuarters
- Date.AddWeeks
- Date.AddYears
- Date.Day
- Date.DayOfWeek
- Date.DayOfWeekName
- Date.DayOfYear
- Date.DaysInMonth
- Date.EndOfDay
- Date.EndOfMonth
- Date.EndOfQuarter
- Date.EndOfWeek
- Date.EndOfYear
- Date.From
- Date.FromText
- Date.IsInCurrentDay
- Date.IsInCurrentMonth
- Date.IsInCurrentQuarter
- Date.IsInCurrentWeek
- Date.IsInCurrentYear
- Date.IsInNextDay
- Date.IsInNextMonth
- Date.IsInNextNDays
- Date.IsInNextNMonths
- Date.IsInNextNQuarters
- Date.IsInNextNWeeks
- Date.IsInNextNYears
- Date.IsInNextQuarter
- Date.IsInNextWeek
- Date.IsInNextYear
- Date.IsInPreviousDay
- Date.IsInPreviousMonth
- Date.IsInPreviousNDays
- Date.IsInPreviousNMonths
- Date.IsInPreviousNQuarters
- Date.IsInPreviousNWeeks
- Date.IsInPreviousNYears
- Date.IsInPreviousQuarter
- Date.IsInPreviousWeek
- Date.IsInPreviousYear
- Date.IsInYearToDate
- Date.IsLeapYear
- Date.Month
- Date.MonthName
- Date.QuarterOfYear
- Date.StartOfDay
- Date.StartOfMonth
- Date.StartOfQuarter
- Date.StartOfWeek
- Date.StartOfYear
- Date.ToRecord
- Date.ToText
- Date.WeekOfMonth
- Date.WeekOfYear
- Date.Year
- DB2.Database
- Decimal.From
- Diagnostics.ActivityId
- Diagnostics.Trace
- DirectQueryCapabilities.From
- Double.From
- Duration.Days
- Duration.From
- Duration.FromText
- Duration.Hours
- Duration.Minutes
- Duration.Seconds
- Duration.ToRecord
- Duration.TotalDays
- Duration.TotalHours
- Duration.TotalMinutes
- Duration.TotalSeconds
- Duration.ToText
E
F
G
H
I
L
- Lines.FromBinary
- Lines.FromText
- Lines.ToBinary
- Lines.ToText
- List.Accumulate
- List.AllTrue
- List.Alternate
- List.AnyTrue
- List.Average
- List.Buffer
- List.Combine
- List.ConformToPageReader
- List.Contains
- List.ContainsAll
- List.ContainsAny
- List.Count
- List.Covariance
- List.Dates
- List.DateTimes
- List.DateTimeZones
- List.Difference
- List.Distinct
- List.Durations
- List.FindText
- List.First
- List.FirstN
- List.Generate
- List.InsertRange
- List.Intersect
- List.IsDistinct
- List.IsEmpty
- List.Last
- List.LastN
- List.MatchesAll
- List.MatchesAny
- List.Max
- List.MaxN
- List.Median
- List.Min
- List.MinN
- List.Mode
- List.Modes
- List.NonNullCount
- List.Numbers
- List.Percentile
- List.PositionOf
- List.PositionOfAny
- List.Positions
- List.Product
- List.Random
- List.Range
- List.RemoveFirstN
- List.RemoveItems
- List.RemoveLastN
- List.RemoveMatchingItems
- List.RemoveNulls
- List.RemoveRange
- List.Repeat
- List.ReplaceMatchingItems
- List.ReplaceRange
- List.ReplaceValue
- List.Reverse
- List.Select
- List.Single
- List.SingleOrDefault
- List.Skip
- List.Sort
- List.Split
- List.StandardDeviation
- List.Sum
- List.Times
- List.Transform
- List.TransformMany
- List.Union
- List.Zip
- Logical.From
- Logical.FromText
But what is the M code behind Cube.Transform, and how does it work? In this article, we’ll explore the inner workings of Cube.Transform and how you can use it to streamline your data analysis workflows.
Understanding the M Code Behind Cube.Transform
To understand the M code behind Cube.Transform, it’s important to first understand what Cube.Transform does. At a high level, Cube.Transform allows you to connect to a multidimensional database, such as an OLAP cube, and import data into Power Query. Once the data is imported, you can use the M language to manipulate and analyze it.
The M code behind Cube.Transform is relatively complex and involves a number of different functions and operations. At its core, however, Cube.Transform is essentially a wrapper function that allows you to connect to a multidimensional database and import data into Power Query.
Here’s a basic example of the M code behind Cube.Transform:
let
Source = Cube.Transform(“Data Source=MyServer;Initial Catalog=MyDatabase”, “MyCube”),
#”MyCube_Measures” = Source{[Schema=”Measures”]}[Data],
#”MyCube_Dimensions” = Source{[Schema=”Dimensions”]}[Data]
in
#”MyCube_Measures”
This M code connects to a multidimensional database located on MyServer and imports data from the "MyCube" cube. It then extracts the measures from the cube and returns them as a table.
Advanced M Code Techniques for Cube.Transform
While the basic M code for Cube.Transform is relatively simple, there are a number of advanced techniques you can use to take your data analysis workflows to the next level.
Here are some tips and tricks for working with the M code behind Cube.Transform:
Using Filters to Extract Specific Data
One of the most powerful features of Cube.Transform is its ability to extract specific data from a multidimensional database. To do this, you can use the "Cube.Filter" function in your M code.
For example, let's say you only want to import sales data for a specific product category. You could use the following M code:
let
Source = Cube.Transform(“Data Source=MyServer;Initial Catalog=MyDatabase”, “MyCube”),
#”MyCube_Sales” = Source{[Schema=”Sales”]}[Data],
#”Filtered Rows” = Cube.Filter(#”MyCube_Sales”, {“Product Category”, “Equals”, “Electronics”})
in
#”Filtered Rows”
This M code connects to the "MyCube" cube and extracts the sales data. It then uses the Cube.Filter function to filter the data to only include sales for the "Electronics" product category.
Using the "Cube.TransformPartition" Function for Performance
If you're working with large datasets, you may find that the performance of Cube.Transform is slow. To improve performance, you can use the "Cube.TransformPartition" function in your M code.
The Cube.TransformPartition function allows you to split your data into smaller partitions and import them into Power Query separately. This can significantly improve performance, especially when working with large datasets.
Here's an example of how to use the Cube.TransformPartition function:
let
Source = Cube.TransformPartition(“Data Source=MyServer;Initial Catalog=MyDatabase”, “MyCube”, [Partition = “Partition1”]),
#”MyCube_Sales” = Source{[Schema=”Sales”]}[Data]
in
#”MyCube_Sales”
This M code uses the Cube.TransformPartition function to split the data into partitions and import only the "Sales" schema. This can help improve performance when working with large datasets.
Using Custom M Code to Transform Data
While Cube.Transform provides a powerful set of built-in functions for manipulating and analyzing data, you may find that you need to use custom M code to transform your data in a specific way.
To do this, you can use the "Cube.TransformData" function in your M code. This function allows you to write custom M code to transform your data before it's imported into Power Query.
Here's an example of how to use the Cube.TransformData function:
let
Source = Cube.TransformData(“Data Source=MyServer;Initial Catalog=MyDatabase”, “MyCube”, (cube) =>
let
#”MyCube_Sales” = cube{[Schema=”Sales”]}[Data],
#”Filtered Rows” = Table.SelectRows(#”MyCube_Sales”, each [SalesAmount] > 1000)
in
#”Filtered Rows”)
in
Source
This M code uses the Cube.TransformData function to import data from the "MyCube" cube and then applies custom M code to filter the data to only include sales with amounts greater than 1000. This custom M code can be as complex or simple as you need it to be, allowing you to transform your data in any way you see fit.
Cube.Transform is a powerful function in Power Query that allows you to import and analyze data from a variety of multidimensional databases. By understanding the M code behind Cube.Transform and using advanced techniques such as filters, partitions, and custom M code, you can take your data analysis workflows to the next level. So start exploring the power of Cube.Transform today and see what insights you can uncover from your data!