在 Power BI 中获取 JSON 形状地图视觉对象的地图键表 [英] Get table of map keys of JSON shape map visual in Power BI

查看:62
本文介绍了在 Power BI 中获取 JSON 形状地图视觉对象的地图键表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有什么简单的方法可以获取地图形状视觉对象的地图键表?我想将地图键作为 Power Query 表获取.最好的方法是从导入地图的 JSON 文件中提取它.

下载文件:

解决方案

扩展 Alexis 的已接受答案,我想变得更有活力.文件的路径是唯一的变量.

letSource = Json.Document(File.Contents("C:\NZ.json")),#"Converted to Table" = Record.ToTable(Source),Value1 = #"转换为表格"{3}[Value],#"转换为Table1" = Record.ToTable(Value1),Value2 = #"转换为 Table1"{0}[Value],几何图形 = Value2[几何图形],#"Converted to Table2" = Table.FromList(geometries, Splitter.SplitByNothing(), null, null, ExtraValues.Error),#"Expanded Column1" = Table.ExpandRecordColumn(#"Converted to Table2", "Column1", {"arcs", "type", "properties"}, {"arcs", "type", "properties"}),#"删除其他列" = Table.SelectColumns(#"Expanded Column1",{"properties"}),ColumnNames = Record.FieldNames(#"Removed Other Columns"[properties]{0}),ExpandProperties = Table.ExpandRecordColumn(#"删除其他列", "属性", ColumnNames, ColumnNames)在展开属性

Is there any easy way to get table of the Map Keys of a map shape visual? I would like to get the map keys as a table of Power Query. The best would be to extract it from JSON file from which the map as been imported.

Download file: NZ.json

解决方案

Expanding accepted answer of Alexis, I would like to go even more dynamic. The path to the file is the only variable.

let
    Source = Json.Document(File.Contents("C:\NZ.json")),
    #"Converted to Table" = Record.ToTable(Source),
    Value1 = #"Converted to Table"{3}[Value],
    #"Converted to Table1" = Record.ToTable(Value1),
    Value2 = #"Converted to Table1"{0}[Value],
    geometries = Value2[geometries],
    #"Converted to Table2" = Table.FromList(geometries, Splitter.SplitByNothing(), null, null, ExtraValues.Error),
    #"Expanded Column1" = Table.ExpandRecordColumn(#"Converted to Table2", "Column1", {"arcs", "type", "properties"}, {"arcs", "type", "properties"}),
    #"Removed Other Columns" = Table.SelectColumns(#"Expanded Column1",{"properties"}),
    ColumnNames = Record.FieldNames(#"Removed Other Columns"[properties]{0}),
    ExpandProperties = Table.ExpandRecordColumn(#"Removed Other Columns", "properties", ColumnNames, ColumnNames)
in 
    ExpandProperties

这篇关于在 Power BI 中获取 JSON 形状地图视觉对象的地图键表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆