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.
Thanks jnickell for the mention and yes your steps described will work!
Hey,
Waking up an old topic but a relevant for me now :) Thanks for this already - the info on this thread has helped me quite a bit :)
However I have run into an issue. I have a large dataset of IP-address information updating every day (over 32k addresses) and I'd like to have the location info as well. This is working now ok, but seems silly to use the API gateway for addresses that I already have the geo info from previous runs.
Is it possible to store the previous info somehow and just use the gateway for new info?
I have currently two tables as I have optimized the gateway load by just getting the info based on address c-class.
table 1:
ip-addrees | reduced to c-class | bunch of stuff
8.8.8.8 | 8.8.8.1 | stuff
8.8.8.12 | 8.8.8.1 | stuff
9.9.9.9 | 9.9.9.1 | stuff
9.9.9.200| 9.9.9.1 | stuff
Table 2:
GeoClassToGet | the geo info tru the function
8.8.8.1 | the geo info
9.9.9.1 | the geo info
So the question is that can I just preserve the table 2 info on the geo info that has been gotten already thru the gateway? And just apped the new info somehow?
Thanks in advance! :)
- GilbertQ7 years agoSuper UserHi there
Currently that would not be possible, but that could change when Incremental refresh comes to the Power BI Service.
You can currently do an incremental refresh in Power BI Premium. Where you could add a date for your IP Addresses and then only process the new ones.