最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

dictionary - PowerBI query error in columns latitude and longitude - Stack Overflow

programmeradmin4浏览0评论

I tried:

The following query in Power Bi produces error values in the columns Latitude and Longitude. I am plugging this code as query in Home/ Transform data/New source/blank query:

let
RingOfFireCoordinates = {
        {-5.0, -80.0}, {-10.0, -85.0}, {-15.0, -90.0}, {-20.0, -95.0}, // South America
        {-25.0, -100.0}, {-30.0, -105.0}, {-35.0, -110.0}, {-40.0, -115.0}, // South America
        {-45.0, -120.0}, {-50.0, -125.0}, {-55.0, -130.0}, {-60.0, -135.0}, // South America
        {-55.0, -140.0}, {-50.0, -145.0}, {-45.0, -150.0}, {-40.0, -155.0}, // Central America
        {-35.0, -160.0}, {-30.0, -165.0}, {-25.0, -170.0}, {-20.0, -175.0}, // North America
        {-15.0, -180.0}, {-10.0, -170.0}, {-5.0, -160.0}, {0.0, -150.0}, // North America
        {5.0, -140.0}, {10.0, -130.0}, {15.0, -120.0}, {20.0, -110.0} // North America
    },
    // Convert the Ring of Fire coordinates into a table
    RingOfFireTable = Table.FromList(RingOfFireCoordinates, Splitter.SplitByNothing(), {"Coordinates"}),
    // Expand the Coordinates into separate rows
    ExpandedTable = Table.ExpandListColumn(RingOfFireTable, "Coordinates"),

    // Add Latitude and Longitude columns by extracting values from the list
    AddLatitude = Table.AddColumn(ExpandedTable, "Latitude", each [Coordinates]{0}),
    AddLongitude = Table.AddColumn(AddLatitude, "Longitude", each [Coordinates]{1}),

    // Remove the original Coordinates column
    RemoveCoordinates = Table.RemoveColumns(AddLongitude, {"Coordinates"}),

    // Convert Latitude and Longitude columns to numeric type
    FinalTable = Table.TransformColumnTypes(RemoveCoordinates, {{"Latitude", type number}, {"Longitude", type number}})

in
    FinalTable

Expected results: When you load this query into Power BI, I am expecting to get a table like this:

Latitude Longitude -5.0 -80.0 -10.0 -85.0 -15.0 -90.0 -20.0 -95.0

Actual results:

发布评论

评论列表(0)

  1. 暂无评论