Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
otykier committed Feb 20, 2024
2 parents 153d056 + 78e50c0 commit b2dc0a2
Show file tree
Hide file tree
Showing 25 changed files with 219 additions and 40 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
with:
submodules: true
- name: Build Documentation
uses: nikeee/docfx-action@v1.0.0
uses: nunit/docfx-action@v3.0.0
with:
args: docfx.json
- name: Build And Deploy
Expand Down
68 changes: 68 additions & 0 deletions common/CSharpScripts/Beginner/script-create-field-parameter.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
---
uid: create-field-parameter
title: Create Field Parameter
author: Daniel Otykier
updated: 2024-01-27
applies_to:
versions:
- version: 2.x
- version: 3.x
---
# Create Field Parameters in

## Script Purpose
If you want to create field parameters in a Power BI model using Tabular Editor or in a Direct Lake model.

> [!TIP]
> Want to see the script in action, check out this [Guy in a Cube video](https://www.youtube.com/watch?v=Cg6zRhwF-Ro) where Patrick LeBlanc explains how to use it step by step.

## Script

### Select Columns or Measures to create a field parameter table
```csharp
// Before running the script, select the measures or columns that you
// would like to use as field parameters (hold down CTRL to select multiple
// objects). Also, you may change the name of the field parameter table
// below. NOTE: If used against Power BI Desktop, you must enable unsupported
// features under File > Preferences (TE2) or Tools > Preferences (TE3).
var name = "Parameter";

if(Selected.Columns.Count == 0 && Selected.Measures.Count == 0) throw new Exception("No columns or measures selected!");

// Construct the DAX for the calculated table based on the current selection:
var objects = Selected.Columns.Any() ? Selected.Columns.Cast<ITabularTableObject>() : Selected.Measures;
var dax = "{\n " + string.Join(",\n ", objects.Select((c,i) => string.Format("(\"{0}\", NAMEOF('{1}'[{0}]), {2})", c.Name, c.Table.Name, i))) + "\n}";

// Add the calculated table to the model:
var table = Model.AddCalculatedTable(name, dax);

// In TE2 columns are not created automatically from a DAX expression, so
// we will have to add them manually:
var te2 = table.Columns.Count == 0;
var nameColumn = te2 ? table.AddCalculatedTableColumn(name, "[Value1]") : table.Columns["Value1"] as CalculatedTableColumn;
var fieldColumn = te2 ? table.AddCalculatedTableColumn(name + " Fields", "[Value2]") : table.Columns["Value2"] as CalculatedTableColumn;
var orderColumn = te2 ? table.AddCalculatedTableColumn(name + " Order", "[Value3]") : table.Columns["Value3"] as CalculatedTableColumn;

if(!te2) {
// Rename the columns that were added automatically in TE3:
nameColumn.IsNameInferred = false;
nameColumn.Name = name;
fieldColumn.IsNameInferred = false;
fieldColumn.Name = name + " Fields";
orderColumn.IsNameInferred = false;
orderColumn.Name = name + " Order";
}
// Set remaining properties for field parameters to work
// See: https://twitter.com/markbdi/status/1526558841172893696
nameColumn.SortByColumn = orderColumn;
nameColumn.GroupByColumns.Add(fieldColumn);
fieldColumn.SortByColumn = orderColumn;
fieldColumn.SetExtendedProperty("ParameterMetadata", "{\"version\":3,\"kind\":2}", ExtendedPropertyType.Json);
fieldColumn.IsHidden = true;
orderColumn.IsHidden = true;
```
### Explanation
Before running the script the user has to select the measures or columns in the TOM Explorer they wish to have in their field parameter table.
The selected objects are then inserted into a calculated table which is then configured as a field parameter table automatically.

Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ author: Morten Lønskov
updated: 2023-11-29
applies_to:
versions:
- version: 2.x
- version: 3.x
---
# Format Numeric Measures
Expand Down
11 changes: 9 additions & 2 deletions common/CSharpScripts/csharp-script-library-beginner.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,14 @@ These are more basic scripts that are easy to understand or modify. They have a
| --- | --- | --- |
| [Count Table Rows](Beginner/script-count-rows.md) | Evaluates a COUNTROWS ( 'Table' ) of a selected table. | When you want to check how many rows are in a table, or if it's been loaded. |
| [Count Model Objects](Beginner/script-count-things.md) | Counts all the different objects by type in a model. | When you need an overview of the model contents or want to count objects by type. |
| [Create Sum Measures from Columns](Beginner/create-sum-measures-from-columns.md) | Create SUM ( 'Table'[Column] ) measures from any selected column. | When you have many columns in a new table / model and must make many measures at once. |
| [Create Sum Measures from Columns](Beginner/script-create-sum-measures-from-columns.md) | Create SUM ( 'Table'[Column] ) measures from any selected column. | When you have many columns in a new table / model and must make many measures at once. |
| [Create M Parameter](Beginner/script-create-m-parameter.md) | Create a new M Parameter in 'Shared Expressions' | When you want to create a parameter to use in other Power Query queries (M Partitions / Shared Expressions). |
| [Edit Hidden Partitions](Beginner/script-edit-hidden-partitions.md) | Reveals the properties of hidden partitions in Calc. Groups & Calc. Tables | When you need to see or edit the TOM properties of these hidden partitions. |
| [Find & Replace in Selected Measures](Beginner/script-find-replace-selected-measures.md) | Searches for a substring in the DAX of selected measures, replacing with another substring. | When you need to quickly find/replace values in multiple DAX measures (i.e. `CALCULATE` filter or broken object references). |
| [Find & Replace in Selected Measures](Beginner/script-find-replace-selected-measures.md) | Searches for a substring in the DAX of selected measures, replacing with another substring. | When you need to quickly find/replace values in multiple DAX measures (i.e. `CALCULATE` filter or broken object references). |
| [Create Measure Table](Beginner/script-create-measure-table.md) | Create a measure table | When you want to create an empty table to use as an organizing measure table|
| [Create Table Groups](Beginner/script-create-table-groups.md) | Organize the model into Table Groups | When you want to have an automatic organization of your tables using the table group feature of Tabular Editor 3 |
| [Format Numeric Measures](Beginner/script-format-numeric-measures.md) | Formats the chosen measures | When you want to quickly apply a format string to the currently selected measures |
| [Show Data Source Dependencies](Beginner/script-show-data-source-dependencies.md) | Shows dependencies for data sources | For explicit (legacy) data sources it can be hard to know exactly where they are used. This script shows you which partition reference the chosen data source |
| [Create Field Parameters](Beginner/script-create-field-parameter.md) | Quickly create a field parameter table | Choose the objects that should be in the field parameter and the script will take care of the rest |


6 changes: 1 addition & 5 deletions common/Datasets/direct-lake-dataset.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,6 @@ applies_to:
# Direct Lake Semantic Models
Direct Lake semantic models connect directly to data sources stored in [Fabric One Lake](https://learn.microsoft.com/en-us/fabric/onelake/onelake-overview).

> [!IMPORTANT]
> Changing a Direct Lake dataset through the XMLA endpoint will block your ability to change the Direct Lake dataset inside the Fabric Service. Only XMLA endpoint can then edit the Direct Lake This is one of the current limitations of this preview
feature.

Tabular Editor 3 can create and connect to this type of dataset. For a tutorial on this please refer to our blog article: [Direct Lake semantic models: How to use them with Tabular Editor](https://blog.tabulareditor.com/2023/09/26/fabric-direct-lake-with-tabular-editor-part-2-creation/).
Tabular Editor 3 can create direct lake semantic models with both the Lakehouse and Datawarehouse SQL Endpoint.

Expand All @@ -38,4 +34,4 @@ Tabular Editor 2 can connect to Direct Lake semantic models, but does not have a
</div>

## Identifying a Direct Lake model
The TOM Explorer informs what object type your tables are. A Direct Lake model's tables will have the object type 'Table (DirectLake)' to make clear that the open model is a Direct Lake model.
The top title bar of Tabular Editor shows which type of model is open in that instance of Tabular Editor. Additionally, the TOM Explorer displays the type and mode of every table (Import, DirectQuery, Dual or Direct Lake). If a model contains a mix of table modes, the title bar will show "Hybrid". Currenctly, it is not possible for a DirectLake model to contain tables in Import, DirectQuery or Dual mode.
1 change: 1 addition & 0 deletions common/toc.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
#### @script-create-measure-table
#### @script-format-numeric-measures
#### @script-create-table-groups
#### @create-field-parameter


### @script-library-advanced
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/tmdl-options.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions te3/features/dax-query.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ Unlike the [DAX Script feature](xrefid:dax-scripts), only the expression propert

The "Apply" option has also been added to the right-click context menu.

![Dax Query New](~/images/features/dax_query_window/dax_query_apply_measure_right_click.png.png)
![Dax Query New](~/images/features/dax_query_window/dax_query_apply_measure_right_click.png)

The shortcuts for these commands are:

Expand All @@ -79,7 +79,7 @@ It is also possible to return the value of a measure but a table constructor {}
EVALUATE
{ [Invoice Lines] }
```
![Dax Query New](~/images/features/dax_query_window/evaluate_measusre.png)
![Dax Query New](~/images/features/dax_query_window/evaluate_measure.png)

### Multiple EVALUATE statements
It is perfectly possible to have multiple EVALUATE statements inside the same DAX query. This type of query is most often encountered with Power BI Performance Analyzer queries.
Expand Down
30 changes: 30 additions & 0 deletions te3/features/pivot-grid.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
---
uid: pivot-grid
title: Pivot Grids
author: Morten Lønskov
updated: 2024-01-22
applies_to:
editions:
- edition: Desktop
- edition: Business
- edition: Enterprise
---
# Pivot Grids

After adding or editing DAX measures in a model, it is common for model developers to test these measures. Traditionally, this was done using client tools such as Excel or Power BI. With Tabular Editor 3, you can use **Pivot Grids** which behave much like the famous PivotTables of Excel. The Pivot Grid lets you quickly create summarized views of the data in your model, allowing you to test the behavior of your DAX measures when filtering and slicing by various columns and hierarchies.

To create a new Pivot Grid, use the **File > New > Pivot Grid** option. From here, you can either drag measures, columns and hierarchies directly from the TOM Explorer into the grid, or you can use the **Pivot Grid > Show fields** menu option to display a popup list of all fields that can be dragged into the Pivot Grid (see screenshot below).

![Show Fields Pivot](~/images/show-fields-pivot.png)

As fields are dragged into the Pivot Grid, Tabular Editor generates MDX queries that are sent to Analysis Services, to display the resulting data. In this regard, the behavior is very similar to Pivot Tables in Excel. You can rearrange fields in the Pivot Grid by dragging and dropping, and there are various right-click menu options available for customizing how the data is displayed.

> [!IMPORTANT]
> Since Pivot Grids relies on the Analysis Services engine for query execution, this feature is not available when working in offline mode (such as when editing a model.bim file in Tabular Editor, without a connection to a workspace database).
![Customizing Pivot Grids](../images/customizing-pivot-grids.png)

The Pivot Grid is automatically refreshed when a change is made to the model or a refresh operation finishes. You can toggle this auto-refresh capability within the **Pivot Grid** menu.

> [!Note]
> The Pivot Grid currently does not work with [hidden fields](https://github.com/TabularEditor/TabularEditor3/issues/345). As a workaround, temporarily unhide the field and save the model, before dragging the field into the Pivot Grid. Moreover, the Pivot Grid only displays values on rows/columns [when at least one measure is present](https://github.com/TabularEditor/TabularEditor3/issues/776).
6 changes: 4 additions & 2 deletions te3/features/supported-files.md
Original file line number Diff line number Diff line change
Expand Up @@ -210,5 +210,7 @@ You can download the official Microsoft BPA rules here: [PBA Rules](https://raw.
Contains all the servers a user has been connected to. It can be advisable to edit it manually to 'forget' past servers no longer relevant.

### Layouts.json
The Layouts file is automatically generated by Tabular Editor when starting the application.
If the Tabular Editor layout does not behave as expected a good first step is to backup this file somewhere else, delete the original and restart Tabular Editor 3.
The Layouts file is automatically generated by Tabular Editor when starting the application. It contains all information to how Tabular Editor 3's UI layout is configured.

> [!TIP]
> Deleting this file will reset Tabular Editor's layout. If the Tabular Editor layout does not behave as expected a good first step is to backup this file somewhere else, delete the original and restart Tabular Editor 3.
8 changes: 6 additions & 2 deletions te3/features/tmdl.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,11 @@ applies_to:
**TMDL** is a model metadata file format [announced by Microsoft in April 2023](https://powerbi.microsoft.com/en-ie/blog/announcing-public-preview-of-the-tabular-model-definition-language-tmdl/). It aims to provide a human-readable, text-based alternative to the JSON-based model.bim file format. TMDL is inspired by YAML, and as such, is easy to read and write, with minimal use of string quotes and escape characters. It also serializes a model as several smaller files in a folder structure, and is therefore also better suited for version control integration.

> [!IMPORTANT]
> As of May 2023, TMDL is still a preview feature. It is currently only supported by community tools such as Tabular Editor and [pbi-tools](https://pbi.tools/). However, the format is fully documented and available through [Microsoft-provided nuget packages](https://www.nuget.org/packages/Microsoft.AnalysisServices.Tabular.Tmdl.retail.amd64/19.64.0-TmdlPreview).
> As of February 2024, TMDL is still a preview feature. It is currently only supported by community tools such as Tabular Editor and [pbi-tools](https://pbi.tools/). However, the format is fully documented and available through [Microsoft-provided nuget packages](https://www.nuget.org/packages/Microsoft.AnalysisServices.Tabular.Tmdl.retail.amd64/19.64.0-TmdlPreview).
> [!TIP]
> Since TMDL is a preview feature, breaking changes could be introduced between new releases of Tabular Editor. If you face any issues deserializing a model after upgrading Tabular Editor, rollback to the latest version of Tabular Editor, then temporarily save the model as a regular .bim file, before serializing it to TMDL again using the latest version of Tabular Editor.

## Enabling TMDL (Preview) in Tabular Editor 3

Expand All @@ -35,4 +39,4 @@ When saving a new model for the first time, Tabular Editor (since v. 3.7.0), wil
# Next steps

- [TMDL overview (Microsoft Learn)](https://learn.microsoft.com/en-us/analysis-services/tmdl/tmdl-overview?view=asallproducts-allversions).
- [Get started with TMDL (Microsoft Learn)](https://learn.microsoft.com/en-us/analysis-services/tmdl/tmdl-how-to?view=asallproducts-allversions)
- [Get started with TMDL (Microsoft Learn)](https://learn.microsoft.com/en-us/analysis-services/tmdl/tmdl-how-to?view=asallproducts-allversions)
2 changes: 1 addition & 1 deletion te3/other/release-notes/3_13_0.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ Tabular Editor 3.3.0 (and newer) uses .NET 6. You may have to install the [.NET

## New in 3.13.0

Check out our [release blog](https://blog.tabulareditor.com/) to get a brief overview of the most important updates in this release.
Check out our [release blog](https://blog.tabulareditor.com/2023/12/15/tabular-editor-3-december-2023-release/) to get a brief overview of the most important updates in this release.

## Improvements in 3.13.0

Expand Down
8 changes: 4 additions & 4 deletions te3/powerbi-xmla-pbix-workaround.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
uid: powerbi-xmla-pbix-workaround
title: Creating PBIX File from XMLA Endoint.
title: Creating PBIX File from XMLA Endpoint.
author: Morten Lønskov
updated: 2023-10-18
applies_to:
Expand All @@ -11,16 +11,16 @@ applies_to:
partial: Tabular Editor 3 Business Edition only allows connecting to the XMLA endpoint of Premium-Per-User (PPU) workspaces.
- edition: Enterprise
---
# Editing a Power BI dataset through the XMLA endpoint
# Downloading a Power BI dataset to a .pbix using the XMLA endpoint

Once a change is made to a Power BI semantic model through the XMLA endpoint, it's not possible to download the dataset as a .pbix file from the Power BI service.
Once a change is made to a Power BI semantic model through the XMLA endpoint, it's not possible to download the model as a .pbix file from the Power BI service.

However, with the Power BI Project file, it's possible to create a .pbix file from the remote model by following the three-step process, which is described as follows.

![XLMA to PBIX Overview](~/images/power-bi/create-pbix-from-xmla-overview.png)

> [!NOTE]
> The described workaround isn't officially supported by Microsoft. There's no guarantee that it works for every model. Specifically, if you've added custom partitions or other objects [not listed here](https://learn.microsoft.com/en-us/power-bi/transform-model/desktop-external-tools#data-modeling-operations), Power BI Desktop may not be able to correctly open the file following this approach.
> The described workaround isn't officially supported by Microsoft. There's no guarantee that it works for every model. Specifically, if you've added custom partitions or other objects [listed here](https://learn.microsoft.com/en-us/power-bi/transform-model/desktop-external-tools#data-modeling-operations), Power BI Desktop may not be able to correctly open the file following this approach.
## Step 1: Create and save an empty Power BI projects (.pbip) file

Expand Down
2 changes: 1 addition & 1 deletion te3/powerbi-xmla.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
uid: powerbi-xmla
title: Power BI XMLA endpoint
title: Editing through XMLA endpoint
author: Daniel Otykier
updated: 2021-10-01
applies_to:
Expand Down
10 changes: 7 additions & 3 deletions te3/toc.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,13 @@
## @whats-new
## @editions
## @desktop-limitations-te3
## @powerbi-xmla
## Power BI XMLA Endpoint
### @powerbi-xmla
### @powerbi-xmla-pbix-workaround

# Documentation
## @user-interface
## User interface
### @user-interface
### @tom-explorer-view
### @bpa-view
### @messages-view
Expand All @@ -24,7 +26,9 @@
### @metadata-translation-editor
### @dax-debugger
### @dax-query
## @supported-files
### @pivot-grid
## Files formats
### @supported-files
### @tmdl
## @preferences
## @shortcuts
Expand Down
Loading

0 comments on commit b2dc0a2

Please sign in to comment.