共用方式為


TOJSON

適用於:計算結果列匯出數據表量值視覺計算

使用 JSON 格式傳回字串形式的資料表。

語法

TOJSON(<Table>, [MaxRows])

參數

詞彙 [定義]
Table 要轉換為 JSON 的資料表。
MaxRows (選擇性) 要轉換的資料列最大數目。 預設為 10 列。

傳回值

具有資料表之 JSON 表示法的字串。 該表示法將資料行名稱包含為 "header"、將資料列計數包含為 “rowCount”,並將值包含為 “data”。

範例

下列 DAX 查詢:

EVALUATE
{TOJSON(DimSalesTerritory)}

傳回:

{
"header": ["'DimSalesTerritory'[SalesTerritoryKey]", "'DimSalesTerritory'[SalesTerritoryAlternateKey]", "'DimSalesTerritory'[SalesTerritoryRegion]", "'DimSalesTerritory'[SalesTerritoryCountry]", "'DimSalesTerritory'[SalesTerritoryGroup]"],<br>
"rowCount": 11,
"data": [
[1, 1, "Northwest", "United States", "North America"],
[2, 2, "Northeast", "United States", "North America"],
[3, 3, "Central", "United States", "North America"],
[4, 4, "Southwest", "United States", "North America"],
[5, 5, "Southeast", "United States", "North America"],
[6, 6, "Canada", "Canada", "North America"],
[7, 7, "France", "France", "Europe"],
[8, 8, "Germany", "Germany", "Europe"],
[9, 9, "Australia", "Australia", "Pacific"],
[10, 10, "United Kingdom", "United Kingdom", "Europe"]
]
}

TOCSV
EVALUATEANDLOG