Forum Discussion
Version AsOf in semantic model.
- 9 months ago
EdvanceIQ_Chris , I doubt we have that available in the Semantic Model Yet.
We have a Power Query function get DeltaLake.Table M (https://youtu.be/D_8ldwRTkyg), but that is also static to the data load
Snapshot is one way, but that will have too much data.
EdvanceIQ_Chris , I doubt we have that available in the Semantic Model Yet.
We have a Power Query function get DeltaLake.Table M (https://youtu.be/D_8ldwRTkyg), but that is also static to the data load
Snapshot is one way, but that will have too much data.
I could not get it to run live, but compromised with allowing users to pass parameters as a batchID and then refresh a model. Took time bit worked. Based on the function I used to decide if the parameter for the batch was passed or not would be how the data was queried. For those that may find this useful the function was :
// Query: GetDeltaLakeTable
(tableName as text) as table =>
let
// Build base connection string
conn = "https://onelake.dfs.fabric.microsoft.com/"
& pWorkspaceName & "/"
& pLakeName & ".Lakehouse/Tables/"
& pSchema & "/",
// Load the target table
Source = AzureStorage.DataLake(conn & tableName, [HierarchicalNavigation=true]),
ToDelta = DeltaLake.Table(Source),
// Decide whether to time travel
timeTravel = Text.Upper(pBatchID) <> "BLANK",
// Branch logic
returnVal =
if timeTravel then
let
// Load CDC batch log table
batchtbl = AzureStorage.DataLake(conn & "_cdc_batch_log", [HierarchicalNavigation=true]),
logTable = DeltaLake.Table(batchtbl),
// Lookup version for this batch + table
Version = GetTableVersion(tableName),
// Get snapshot at that version
GetVersions = Value.Versions(ToDelta),
Result = if Version <> null then GetVersions{Version}[Data] else ToDelta
in
Result
else
ToDelta
in
returnVal