TMDL 腳本可讓您將動作套用至語意模型,這可能是變更或作業。 TMDL 腳本有兩個部分:
- 命令,這是必要命令,應該在 TMDL 腳本頂端宣告。
- 使用 TMDL 語言定義或參考 一或多個
語意模型物件。
語法:
<TMDL Command name>
<TMDL object>
[<TMDL object>]
CreateOrReplace 命令
建立或取代指定的語意模型物件和所有子系。 現有的物件會取代為新的定義。
createOrReplace 命令內的 TMDL 物件順序並不重要。
TMDL 語言的語意會套用至 createOrReplace 命令內
例
從數據表建立或取代量值 # ProductsSales,以及數據表的完整定義,Product:
createOrReplace
ref table Sales
measure '# Products (with Sales)' = DISTINCTCOUNT('Sales'[ProductKey])
formatString: #,##0
table Product
measure '# Products' = COUNTROWS('Product')
formatString: #,##0
column Product
dataType: string
isDefaultLabel
summarizeBy: none
sourceColumn: Product
column Category
dataType: string
summarizeBy: none
sourceColumn: Category
partition Product-partition = m
mode: import
source =
let
Source = #"RAW-Product",
#"Renamed Columns" = Table.RenameColumns(Source,{{"Product Name", "Product"}})
in
#"Renamed Columns"
考慮和限制
每個文稿執行只支援一個命令動詞。
相關內容
下列文章將詳細說明 TMDL 及其用法。