semantic-link-labs icon indicating copy to clipboard operation
semantic-link-labs copied to clipboard

Import Model To Direct Lake Migration

Open cvlmonica opened this issue 1 year ago • 14 comments

While doing the migration from import mode to direct lake. It is considering #Measures as calculated table and it is stopping the migration.

Image

What should we do here?! Any suggestions so that the Semantic-Link-Labs ignores this!?

cvlmonica avatar Oct 14 '24 06:10 cvlmonica

What is the '# Measure' table? Is it a regular data table? Does it have any columns? Please share more details on the properties of this table.

m-kovalsky avatar Oct 14 '24 08:10 m-kovalsky

Yes, It is an empty calculated table! to place all the measures at one place! Since we cannot have an empty table in lakehouse? how to do this?

cvlmonica avatar Oct 14 '24 09:10 cvlmonica

You need to create a sort of 'dummy' table in the lakehouse, as such, add it to the model, and place all the measures in that table.

import sempy_labs as labs
import pandas as pd

df = pd.DataFrame(columns=['NewCol'])
schema = {
    "NewCol": "str",
}
labs.save_as_delta_table(dataframe=df, delta_table_name="MeasuresTable", write_mode='overwrite', schema=schema)

m-kovalsky avatar Oct 14 '24 16:10 m-kovalsky

I have tried running the above script and created an measures table and when I trying to run the migrate_model_objects_to_semantic_model() function, it is throwing below error:

Few measures are getting created which are not part of that measures table.

Image

Image

With this, what is happening is it is breaking at this point and it cannot create other objects in semantic model!

cvlmonica avatar Oct 17 '24 11:10 cvlmonica

Hi! any solution on this?

cvlmonica avatar Oct 24 '24 09:10 cvlmonica

What is the Dax behind the '# measures' calculated table?

m-kovalsky avatar Oct 31 '24 20:10 m-kovalsky

This is an empty calculated table which we are storing the all the measures. So it is an empty calculated table!

cvlmonica avatar Nov 12 '24 11:11 cvlmonica

Please share the DAX behind the calculated table

m-kovalsky avatar Nov 14 '24 07:11 m-kovalsky

Yes sharing the DAX #Measures =

cvlmonica avatar Nov 14 '24 07:11 cvlmonica

Where is the dax?

m-kovalsky avatar Nov 14 '24 07:11 m-kovalsky

Hi @m-kovalsky

There is no DAX required for this. If you click on "Enter Data" and provide a name for the table with one column and one row, Power BI will create a table with a single column.

Please see the screenshot below. When you hide this column and if only measures are visible in the table, it will function as a measure group.

Image

Image

Image

Image

Below is the backend code that Power BI generates for model.bim: { "compatibilityLevel": 1567, "model": { "annotations": [ { "name": "__PBI_TimeIntelligenceEnabled", "value": "0" }, { "name": "PBIDesktopVersion", "value": "2.139.2054.0 (24.12)+334ca1c95b576cc53924655643b0d36f21caac55" }, { "name": "PBI_ProTooling", "value": "["DevMode"]" }, { "name": "PBI_QueryOrder", "value": "["# Measures"]" } ], "culture": "en-US", "cultures": [ { "name": "en-US", "linguisticMetadata": { "content": { "Language": "en-US", "Version": "1.0.0" }, "contentType": "json" } } ], "dataAccessOptions": { "legacyRedirects": true, "returnErrorValuesAsNull": true }, "defaultPowerBIDataSourceVersion": "powerBI_V3", "sourceQueryCulture": "en-US", "tables": [ { "name": "# Measures", "annotations": [ { "name": "PBI_ResultType", "value": "Table" } ], "columns": [ { "name": "Column1", "annotations": [ { "name": "SummarizationSetBy", "value": "Automatic" } ], "changedProperties": [ { "property": "IsHidden" } ], "dataType": "string", "isHidden": true, "lineageTag": "e4492d8e-53cf-4a5a-8213-171ad9289960", "sourceColumn": "Column1", "summarizeBy": "none" } ], "lineageTag": "eaf613d2-dc81-4a78-9633-401450e5017c", "measures": [ { "name": "Test Measure", "expression": ""Test"", "lineageTag": "48cf86c6-baa5-4177-a81c-6452569230fa" } ], "partitions": [ { "name": "# Measures", "mode": "import", "source": { "expression": [ "let", " Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i44FAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Column1 = _t]),", " #"Changed Type" = Table.TransformColumnTypes(Source,{{"Column1", type text}})", "in", " #"Changed Type"" ], "type": "m" } } ] }, { "name": "Table", "annotations": [ { "name": "PBI_Id", "value": "ec603e7f8bf24574be944610d7eb4e6f" }, { "name": "436ba87b-9c83-4389-a31b-ebd06a36be98", "value": "{"Expression":""}" } ], "columns": [ { "name": "Column", "annotations": [ { "name": "SummarizationSetBy", "value": "Automatic" } ], "dataType": "int64", "formatString": "0", "isDataTypeInferred": true, "isNameInferred": true, "lineageTag": "608fa0c8-97af-4757-a7e9-2bfb6f3d82a4", "sourceColumn": "[Column]", "summarizeBy": "sum", "type": "calculatedTableColumn" } ], "lineageTag": "ec7f3f62-a0f9-42e2-9cf0-f3f4887b98ea", "partitions": [ { "name": "Table", "mode": "import", "source": { "expression": "Row("Column", BLANK())", "type": "calculated" } } ] } ] } }

AkhilGrandhi avatar Feb 21 '25 06:02 AkhilGrandhi

We are trying to migrate a semantic model with a large number of numeric parameters (which result in calculated tables). I see the same error message for those tables.

Is there a way around this?

I'm happy to provide any additional context to help out.

betaigeuze avatar Aug 13 '25 09:08 betaigeuze

@AkhilGrandhi this is DAX (from your TMSL)

Row("Column", BLANK())

Currently it seems there's an issue with blank tables being migrated. i'll look into that.

m-kovalsky avatar Sep 01 '25 12:09 m-kovalsky

@betaigeuze please raise a new issue regarding your request/issue with details.

m-kovalsky avatar Sep 01 '25 12:09 m-kovalsky