This time we’re going bigger than ever. Fabric, Power BI, SQL, AI and more. We're covering it all. You won't want to miss it.
Learn moreDid you hear? There's a new SQL AI Developer certification (DP-800). Start preparing now and be one of the first to get certified. Register now
We’re excited to introduce TMDL view for Power BI Desktop. This new feature lets you script, modify, and apply changes using Tabular Model Definition Language (TMDL), providing an alternative experience to semantic modeling using code, instead of a graphical user interface such as Model view. Future updates will integrate Copilot, laying the foundation for advanced Copilot modeling interactions handling time-intensive tasks such as model translations, bulk operations, among others.
TMDL view enhances the semantic modeling experience for Power BI developers, offering several advantages:
Deep_dive_into_TMDL_view_for_Power_BI_Desktop_Preview
Once the preview feature is enabled, the TMDL view tab will appear on the left side of the Power BI Desktop window:
Deep_dive_into_TMDL_view_for_Power_BI_Desktop_Preview
When first opening TMDL view, the code editor will be empty, you can script any semantic model object such as table, measure or column by selecting the objects from the Data pane and dragging them into the code editor:
Deep_dive_into_TMDL_view_for_Power_BI_Desktop_Preview
TMDL view scripts the selected semantic model objects into a code tab as a TMDL createOrReplace script. It's a scripting experience similar to scripting a table or database in SQL Server Management Studio.
Deep_dive_into_TMDL_view_for_Power_BI_Desktop_Preview
Each time you script an object; a new tab is created. You can have multiple script tabs at once, which can be renamed or removed.
Deep_dive_into_TMDL_view_for_Power_BI_Desktop_Preview
The contents of the TMDL view tabs are saved in the file (PBIX or PBIP), so you can continue where you left off the next time you open the Power BI Desktop report.
You can script one or more objects by holding the CTRL key and either dragging the object from the Data pane into the code editor, or right-clicking and selecting the Script TMDL option to a new tab or clipboard. The full definition of the selected objects will be scripted into the code editor.
Deep_dive_into_TMDL_view_for_Power_BI_Desktop_Preview
Deep_dive_into_TMDL_view_for_Power_BI_Desktop_Preview
As a code editor, TMDL view facilitates bulk changes to your semantic model efficiently and provides useful features like search-and-replace, keyboard shortcuts, and multi-line editing. For instance, if you need to remove the prefix "dim_" or "fact_" from all your tables, you can script the full model, search for "dim_|fact_" (as a regular expression), and replace it with an empty string.
Deep_dive_into_TMDL_view_for_Power_BI_Desktop_Preview
When you're ready, you can select the Apply button to execute the TMDL script against the semantic model and have your TMDL code changes applied in a single step.
Deep_dive_into_TMDL_view_for_Power_BI_Desktop_Preview
When successful, a notification is displayed, and your modeling change are applied to the semantic model.
Deep_dive_into_TMDL_view_for_Power_BI_Desktop_Preview
In the event of a failure, an error notification is displayed to show that your modeling changes weren't applied to the semantic model. You can view more information about the error by selecting the Show details link in the notification, which then expands the Output pane and displays error details.
Deep_dive_into_TMDL_view_for_Power_BI_Desktop_Preview
TMDL view modifies only the semantic model metadata, without refreshing data or affecting the report. If your changes require a data refresh, such as altering a PowerQuery expression or calculated column expression, it is necessary to manually refresh the table or model for the changes to take effect. Additionally, renaming a field in the TMDL view may break visuals within the report that use that field.
Deep_dive_into_TMDL_view_for_Power_BI_Desktop_Preview
Deep_dive_into_TMDL_view_for_Power_BI_Desktop_Preview
For example, if you want to share a calculation group you created with a colleague, you just need to follow these steps:
Deep_dive_into_TMDL_view_for_Power_BI_Desktop_Preview
TMDL view is also excellent for community and social media sharing. For instance, if it had been available when Zoe Douglas wrote her amazing blog post about calculation groups, she could have included a TMDL script like the following to help readers create the same calculation group.
createOrReplace
table 'Time Intelligence'
calculationGroup precedence: 1
calculationItem YTD = CALCULATE ( SELECTEDMEASURE (), DATESYTD ( 'Calendar'[Date] ) )
calculationItem QTD = CALCULATE ( SELECTEDMEASURE (), DATESQTD ( 'Calendar'[Date] ) )
calculationItem MTD = CALCULATE ( SELECTEDMEASURE (), DATESMTD ( 'Calendar'[Date] ) )
calculationItem Current = SELECTEDMEASURE()
column 'Show as' dataType: string sourceColumn: Name sortByColumn: Ordinal
column Ordinal dataType: int64 formatString: 0 summarizeBy: none sourceColumn: Ordinal
You can and should use both experiences together. For example, PBIP and Visual Studio Code can be used to update the semantic model definition without launching Power BI Desktop. The TMDL view in Power BI Desktop can be used to easily apply multiple changes to the semantic model efficiently. Both experiences with the same rich TMDL code experience.
Learn more about TMDL view features and its limitations in our documentation: Work with TMDL view in Power BI Desktop (preview).
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.