Value.Versions

Updated on

Value.Versions is a Power Query M function whose purpose and return value are not documented.

Compatible with: Power BI Service Power BI Desktop Excel Microsoft 365

Syntax

Value.Versions( value as any ) as table

Description

The Value.Versions function enables access to different versions of data in sources supporting versioning. It returns a table with rows representing each data version, where Version 0 is the earliest and the highest number number signifies the latest version.

Examples

Suppose you’re working with the Lakehouse.Contents function.

let
  Source          = Lakehouse.Contents(), 
  SelectWorkspace = Source{[workspaceId = "insertworkspaceid"]}[Data], 
  SelectLakehouse = SelectWorkspace{[lakehouseId = "insertlakehouseid"]}[Data], 
  SelectTable     = SelectLakehouse{[Id = "nested_table", ItemKind = "Table"]}[Data]
in
  SelectTable
Value.Versions Base Table to retrieve in Power Query M
Source: crossjoin.co.uk

Using the Value.Versions function you can retrieve a table with all different versions available.

let
  Source          = Lakehouse.Contents(),
  SelectWorkspace = Source{[workspaceId = "insertworkspaceid"]}[Data],
  SelectLakehouse = SelectWorkspace{[lakehouseId = "insertlakehouseid"]}[Data],
  SelectTable     = SelectLakehouse{[Id = "nested_table", ItemKind = "Table"]}[Data],
  ShowVersions    = Value.Versions(SelectTable)
in
  ShowVersions
Value.Versions to show versions of Lakehouse.Contents in Power Query M
Source: crossjoin.co.uk

The latest version of your data is represented by version 0, and each later version gets an incremented version number. To access the tables with the different version data you can drill into the Values in the ‘Data’ column. For instance, to drill into the value of version 1, you can find it in the second row of the data column. When you provide both a column name and a row index, you can zoom into that value, which looks as follows:

let
  Source           = Lakehouse.Contents(),
  SelectWorkspace  = Source{[workspaceId = "insertworkspaceid"]}[Data],
  SelectLakehouse  = SelectWorkspace{[lakehouseId = "insertlakehouseid"]}[Data],
  SelectTable      = SelectLakehouse{[Id = "nested_table", ItemKind = "Table"]}[Data],
  ShowVersions     = Value.Versions(SelectTable),
  GetVersion1      = ShowVersions{1}[Data]
in
  GetVersion1

Learn more about Value.Versions in the following articles:

Other functions related to Value.Versions are:

Contribute » | Contributors: Rick de Groot
Microsoft documentation: https://learn.microsoft.com/en-us/powerquery-m/value-versions

2023-2024 © BI Gorilla. All rights are reserved. Information from Microsoft docs is property of Microsoft Corp. | Privacy Policy