TOJSON
Berlaku untuk: Kolom terhitung Tabel terhitung Ukur perhitungan Visual
Mengembalikan tabel sebagai string menggunakan format JSON.
Sintaks
TOJSON(<Table>, [MaxRows])
Parameter
Term | Definisi |
---|---|
Tabel | Tabel yang akan dikonversi ke JSON. |
MaxRows | (Opsional) Angka maksimum untuk dikonversi baris. Defaultnya adalah 10 baris. |
Nilai hasil
String dengan representasi JSON dari tabel. Representasi berisi nama kolom sebagai "header", count-of-rows sebagai "rowCount", dan nilai sebagai "data".
Contoh
Kueri DAX berikut:
EVALUATE
{TOJSON(DimSalesTerritory)}
Menampilkan:
{
"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"]
]
}