TOJSON
使用 JSON format以字符串形式返回表。
语法
TOJSON(<Table>, [MaxRows])
parameters
术语 | 定义 |
---|---|
Table |
要转换为 JSON 的表。 |
MaxRows |
(可选)要 convert的最大行数。 默认值为 10 行。 |
返回 value
采用表的 JSON 表示形式的字符串。 表示形式 contains 列名作为“header”,count行作为“rowCount”,andvalues 为“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"]
]
}