5 Replies Latest reply on Sep 23, 2012 10:12 PM by Dimitri.B

Need to be able to "calculate" within Tableau:  IP Address (database) field (ex. 100.200.50.25) to numeric....+(100*256*256*256)+(200*256*256)+(50*256)+25

In Excel (old school, I know), I have to do a "Text to Columns" of the IP to individual columns then do the calculation.

Thanks,

Jim

• ###### 1. Re: IP Address conversion

One way to do it is to use Tableau's built-in text and conversion functions, as in the attached example.

The idea is to use the IP address pattern of x.x.x.x to extract each 'x' element and convert it to a number.

I used step-by-step approach for clarity, but it is also possible to combine all steps into one big "mother of all custom calculations" field.

• ###### 2. Re: IP Address conversion

Great example!!  Any thoughts on "joining" this with a GeoLoc spreadsheet (StartCalcIP, EndCalc. Country)?

• ###### 3. Re: IP Address conversion

Not sure what you mean, what is GeoLoc spreadsheet?

• ###### 4. Re: IP Address conversion
 StartCalcIP EndCalcIP Country Code Country 7602176 7864319 AT Austria 16777216 16777471 AU Australia 16777472 16778239 CN China 16778240 16779263 AU Australia 16779264 16781311 CN China 16781312 16785407 JP Japan 16785408 16793599 CN China 16793600 16809983 JP Japan 16809984 16842751 TH Thailand 16842752 16843007 CN China

Using your example above, the result of your calculation, I need to lookup in this table to get the country.  Your Calculated IP would be between the numbers in the first two columns.

Hope that helps.

• ###### 5. Re: IP Address conversion

If you want to do it internally in Tableau via data blending or hard-coded, then I can only think of a monster IF or CASE statement.

Otherwise, but depending on your data source, it is an easy join job with two tables, but the IP address data must be already converted before the join, so you are back to square one with this.