Forum Discussion
IP address mapping
- 9 years ago
Hi reno1
You can do it with the following steps below.
You need to create a function with the following code below with the name of fn_GetIPAddress
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 SourceThe function will return the output into a table.
Then what you do is where your data is in the Query Editor you click on Invoke Custom Function, then put in the required fields as shown below.
NOTE: Make sure to select your column above that has got the IP Addresses
Then once you click Ok you will see the table as shown below.
Click on the Expand Table button, leave all the defaults and click Ok.
You should then get the details for each IP Address.
NOTE: There are more columns but I snipped them off.
Please let me know if this works or you get stuck.
GilbertQ thanks for the response.
I have found an IP address database and successfully imported it into power BI. What I am unsure about now is how to find where each IP address sits within the range of IP addresses in the IP database. The IP addresses I have are in the format '8.8.8.8', and the corresponding row in the IP database is '8.8.8.0/16'. Do you have any idea how to do this in Power BI, or where I can go to for information?
I assume the subnet doesn't change the location of the ip range, correct?
Can you share the IP locations database? Or provide some sample data that we can play with?