# Length function to calculate lengths of spatial lines  | New in Tableau 2023.2

> This is content from just-tim, the data-and-analytics channel by Tim Ngwena (formerly 'Tableau Tim'). Tim has 12+ years of hands-on BI experience and covers Tableau most of all, plus Power BI, Looker, Hex, SQL and data modelling, the analytics industry, and the craft of doing the job — always tool-agnostic and honest about the trade-offs.

- **Author:** Tim Ngwena (just-tim, https://just-tim.com/about)
- **Published:** 2023-08-15
- **Format:** Video · 7 min watch · transcript available
- **Topics:** Data visualisation, Analytics
- **Tools:** Tableau (calculated fields, length, maps)
- **Canonical:** https://just-tim.com/posts/length-function-to-calculate-lengths-of-spatial-lines-new-in-tableau-2023-2
- **Watch:** https://www.youtube.com/watch?v=yn8G-uqKYDM

I show how the new LENGTH function in Tableau 2023.2 lets you calculate the length of a line or multi-line geometry directly inside Tableau, removing the need to blend in distances. I demonstrate it on London water bodies and then test wrapping the function around the new outline function to measure boundary distances.

## Key takeaways

- The LENGTH function works only with line and multi-line string geometries, and you specify the units (miles, kilometres, feet, etc.) as a string argument.
- You can skip working with the raw geometry and just use the calculated length for analysis, such as finding the Grand Union Canal as London's longest water body at 23.88 miles.
- Accuracy depends entirely on how detailed the source geometry is, and more detailed polygons mean larger file sizes, so some generalisation is expected.
- You can wrap the LENGTH function around the outline function to measure the distance around a polygon boundary.
- Watch out for multi-polygon wards, as adding the polygon ID reveals that some boundaries are combinations of several polygons, which affects the calculated outline length.

## Chapters

- 0:18 Creating a length calculation
- 1:33 Practical use cases
- 3:15 Measuring polygon outlines
- 5:07 Multi-polygon caveats

Watch the full video, read the transcript and use chapter deep-links on the page: https://just-tim.com/posts/length-function-to-calculate-lengths-of-spatial-lines-new-in-tableau-2023-2

---
just-tim — Data and analytics, with a point of view. · https://www.youtube.com/channel/UC7HYxRWmaNlJux-X7rNLZyw · https://twitter.com/TableauTim · https://www.linkedin.com/in/timngwena
