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
Cube.Properties is a powerful function that allows you to retrieve metadata about a cube or a tabular model. It can be used to retrieve information about the structure of the model, the data sources, and the relationships between tables. In this article, we will explore the M code behind the Cube.Properties function and show you how to use it to retrieve useful information about your data model.
What is the Cube.Properties Function?
Before we dive into the M code behind the Cube.Properties function, let’s first understand what it does. The Cube.Properties function is used to retrieve metadata about a cube or a tabular model. It takes two arguments: the server name and the cube name. Here is the syntax of the Cube.Properties function:
Cube.Properties(server as text, cube as text) as record
The function returns a record that contains various properties of the cube or tabular model. These properties include the name of the cube, the data sources used in the model, the tables and columns in the model, and the relationships between the tables.
Understanding the M Code behind Cube.Properties
Now that we know what the Cube.Properties function does, let's take a look at the M code behind it. The Cube.Properties function is actually a combination of several other M functions that work together to retrieve the metadata about the cube or tabular model.
Here are the M functions that make up the Cube.Properties function:
- `AnalysisServices.Database`: This function connects to the Analysis Services database and retrieves the metadata about the cube or tabular model.
- `AnalysisServices.Cube`: This function retrieves the metadata about the cube or tabular model.
- `AnalysisServices.DataSources`: This function retrieves the data sources used in the cube or tabular model.
- `AnalysisServices.Tables`: This function retrieves the tables in the cube or tabular model.
- `AnalysisServices.Columns`: This function retrieves the columns in the cube or tabular model.
- `AnalysisServices.Relationships`: This function retrieves the relationships between the tables in the cube or tabular model.
Each of these functions is used to retrieve a specific type of metadata about the cube or tabular model. The Cube.Properties function combines the results of these functions into a single record that contains all of the metadata.
How to Use Cube.Properties to Retrieve Metadata
Now that we understand the M code behind the Cube.Properties function, let's take a look at how to use it to retrieve metadata about our cube or tabular model.
To use the Cube.Properties function, we first need to create a new query in Power Query. Here are the steps to create a new query:
1. Open Excel or Power BI.
2. Go to the Data tab and click on "From Other Sources".
3. Click on "Blank Query" to create a new query.
4. In the new query window, click on "Advanced Editor".
5. In the Advanced Editor window, paste the following M code:
let
Source = Cube.Properties(“localhost”, “Adventure Works DW”),
#”Expanded DataSources” = Table.ExpandTableColumn(Source, “DataSources”, {“DataSourceID”, “DataSourceName”, “ConnectionString”}, {“DataSources.DataSourceID”, “DataSources.DataSourceName”, “DataSources.ConnectionString”}),
#”Expanded Tables” = Table.ExpandTableColumn(#”Expanded DataSources”, “Tables”, {“TableName”, “Columns”}, {“Tables.TableName”, “Tables.Columns”}),
#”Expanded Columns” = Table.ExpandTableColumn(#”Expanded Tables”, “Tables.Columns”, {“ColumnName”, “DataType”, “DataSourceID”, “DataSourceName”, “TableName”, “TableID”}, {“Tables.Columns.ColumnName”, “Tables.Columns.DataType”, “Tables.Columns.DataSourceID”, “Tables.Columns.DataSourceName”, “Tables.Columns.TableName”, “Tables.Columns.TableID”}),
#”Expanded Relationships” = Table.ExpandTableColumn(#”Expanded Columns”, “Relationships”, {“FromTableName”, “FromColumnName”, “ToTableName”, “ToColumnName”, “RelationshipType”}, {“Relationships.FromTableName”, “Relationships.FromColumnName”, “Relationships.ToTableName”, “Relationships.ToColumnName”, “Relationships.RelationshipType”})
in
#”Expanded Relationships”
This M code retrieves the metadata about the "Adventure Works DW" cube on the "localhost" server. You can modify this code to retrieve the metadata about your own cube or tabular model.
Once you have pasted the M code into the Advanced Editor window, click on "Done" to close the window. The query will now execute and retrieve the metadata about the cube or tabular model.
Understanding the Output of Cube.Properties
The output of the Cube.Properties function is a record that contains various properties of the cube or tabular model. These properties are grouped into several tables, as shown below:
- DataSources: This table contains information about the data sources used in the cube or tabular model, including the data source ID, name, and connection string.
- Tables: This table contains information about the tables in the cube or tabular model, including the table name, columns, and table ID.
- Columns: This table contains information about the columns in the cube or tabular model, including the column name, data type, and table ID.
- Relationships: This table contains information about the relationships between the tables in the cube or tabular model, including the from table name, from column name, to table name, to column name, and relationship type.
You can use these tables to retrieve specific information about your cube or tabular model. For example, you can use the DataSources table to retrieve the connection string for a particular data source, or you can use the Tables table to retrieve the columns for a particular table.
The Cube.Properties function is a powerful tool for retrieving metadata about a cube or tabular model in Power Query. By understanding the M code behind this function, you can customize it to retrieve specific information about your own data model. Whether you are a business analyst, a data scientist, or a data engineer, the Cube.Properties function can help you to better understand the structure and relationships of your data.