簡體   English   中英

如何在 Power BI 中使用 IP 進行定位?

[英]How to use IP for location in Power BI?

當前正在嘗試通過 IP 從 SQL-Server 數據源添加用戶地圖。 IP 要么映射到錯誤的位置,要么根本不使用 Power BI 的內置查找進行映射。

有沒有辦法通過 IP 列查詢位置? 或者任何已知的 API 來為我做這件事?

試試這個: freegeoip.net

http://freegeoip.net/xml/8.8.8.8

它返回:

<Response>
<IP>8.8.8.8</IP>
<CountryCode>US</CountryCode>
<CountryName>United States</CountryName>
<RegionCode>CA</RegionCode>
<RegionName>California</RegionName>
<City>Mountain View</City>
<ZipCode>94035</ZipCode>
<TimeZone>America/Los_Angeles</TimeZone>
<Latitude>37.386</Latitude>
<Longitude>-122.0838</Longitude>
<MetroCode>807</MetroCode>
</Response>

或者使用 JSON:

http://freegeoip.net/json/8.8.8.8

{"ip":"8.8.8.8","country_code":"US","country_name":"United States","region_code":"CA","region_name":"California","city":"Mountain View","zip_code":"94035","time_zone":"America/Los_Angeles","latitude":37.386,"longitude":-122.0838,"metro_code":807}

我遇到了類似的問題,這就是我所做的。

  1. 我從源數據表中創建了一個具有不同 IP 地址表。
  2. 創建了一個自定義函數,用於查詢 IP 地址並獲取其詳細信息(參見底部)。
  3. 單擊功能區中的添加列,然后單擊調用自定義函數
  4. 查詢完成后,單擊新列並通過單擊右上角的圖標展開表。

-- 對我有用的函數代碼

= let
    Source = (#"IP Address" as text) => let
    Source = Json.Document(Web.Contents("http://freegeoip.net/json/" & #"IP Address")),
    #"Converted to Table" = Record.ToTable(Source),
    #"Transposed Table" = Table.Transpose(#"Converted to Table"),
    #"Promoted Headers" = Table.PromoteHeaders(#"Transposed Table")
in
    #"Promoted Headers"
in
    Source

來源

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM