TOJSON

适用于:计算列计算表度量值视觉对象计算

以 JSON 格式的字符串形式返回表。

语法

TOJSON(<Table>, [MaxRows])

parameters

术语 定义
要转换为 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