Skip to content

TMDL does not store measure data type #67

@rfreer

Description

@rfreer

Tabular Editor Desktop (Expected Behavior)

As released, the best practice rule "[Formatting] Whole numbers should be formatted with thousands separators and no decimals" flags any measure that is not formatted as a percentage or dollar amount as being in violation of the rule. This means any string measures are marked as a violation.

Image

To account for this, my team modified the BP rule to exclude strings and measures defined as blank, using the following rule.
not FormatString.Contains("$") and not FormatString.Contains("%") and not (FormatString = "#,0" or FormatString = "#,0.0") and DataType != "String" and Expression != "BLANK()"

Running this version in Tabular Editor on desktop does appropriately exclude the string measure, even without a Format String defined, as we expect.

Image

Tabular Editor Portable Executable and TMDL

We also want the BPA to run as part of our Azure DevOps pipeline for quality control. However, when we run BPA using the Tabular Editor portable executable on the pbip file, the errors for measures without a format string reappear.

We are running the portable executable in PowerShell using the following code: Start-Process -FilePath "$toolPath" -ArgumentList """$itemPath"" -A ""$rulesPath"" -V" -NoNewWindow -Wait

Where $toolPath is the path to the executable, $itemPath is the path to the definition folder in the semantic model folder, and $rulesPath is the path to the BPA-Rules.json file.

I determined it throws a violation again because the data type is not defined in the TMDL file for measures, even though Tabular Editor desktop can correctly identify a measure as a string (as shown in the first image).

Image

I can also see the data type in the measure metadata if I query the semantic model in analysis services.

Image

If you add a dataType property to the TMDL file, the errors no longer show. However, we do not want to use this as a solution since it requires manual work and could potentially cause issues down the line. As far as I can tell, the measure data types are not stored anywhere in the json files. Is there a way to get the portable version of TE to be able to identify the measure data types?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions