Forum Discussion

nanutum's avatar
nanutum
Helper I
5 years ago

Power Query : Google map KPI : "We cannot convert the value 0 to type Table"

i used Googlemap Kpi :  Reverse Geocoding

 

 

My Code 

 

let
    Source = Excel.CurrentWorkbook(){[Name="GPS"]}[Content],
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Customer_Code", type text}, {"Latitude", type number}, {"Longitude", type number}}),
    #"Rounded Off" = Table.TransformColumns(#"Changed Type",{{"Latitude", each Number.Round(_, 5), type number}, {"Longitude", each Number.Round(_, 5), type number}}),
    #"Added Custom" = Table.AddColumn(#"Rounded Off", "Custom", each try #"Maping"(Number.ToText([Latitude]),Number.ToText([Longitude])) otherwise 0),
    #"Expanded Custom" = Table.ExpandTableColumn(#"Added Custom", "Custom", {"postal_code", "administrative_area_level_1"}, {"postal_code", "administrative_area_level_1"})
in
    #"Expanded Custom"

 

 

Result 

Result Gps

 

 in Power Query is not show Error 

when "close and load" show this error 

 

Please Help me

3 Replies

  • Jimmy801's avatar
    Jimmy801
    Community Champion

    Hello nanutum 

     

    what is returning this query?

    let
        Source = Excel.CurrentWorkbook(){[Name="GPS"]}[Content],
        #"Changed Type" = Table.TransformColumnTypes(Source,{{"Customer_Code", type text}, {"Latitude", type number}, {"Longitude", type number}}),
        #"Rounded Off" = Table.TransformColumns(#"Changed Type",{{"Latitude", each Number.Round(_, 5), type number}, {"Longitude", each Number.Round(_, 5), type number}}),
        #"Added Custom" = Table.AddColumn(#"Rounded Off", "Custom", each try #"Maping"(Number.ToText([Latitude]),Number.ToText([Longitude])) otherwise 0),
        #"Expanded Custom" = Table.ExpandTableColumn(#"Added Custom", "Custom", {"postal_code", "administrative_area_level_1"}, {"postal_code", "administrative_area_level_1"})
    in
        Table.SelectRowsWithErrors(#"Expanded Custom")

     

    If this post helps or solves your problem, please mark it as solution (to help other users find useful content and to acknowledge the work of users that helped you)
    Kudoes are nice too

    Have fun

    Jimmy

     

      • Jimmy801's avatar
        Jimmy801
        Community Champion

        Hello nanutum 

         

        i modified this query in order to return your table with all rows that contain an error. So in some way, this result given by my query should give you the row(s) that causing the error when importing in power BI

         

        If this post helps or solves your problem, please mark it as solution (to help other users find useful content and to acknowledge the work of users that helped you)
        Kudoes are nice too

        Have fun

        Jimmy