# How to do multi-line calculations and edits for Tableau: Quick Tip

> 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:** 2021-08-11
- **Format:** Video · 11 min watch · transcript available
- **Topics:** Data visualisation, Productivity
- **Tools:** Excel; Tableau (calculated fields, case statements)
- **Canonical:** https://just-tim.com/posts/how-to-do-multi-line-calculations-and-edits-for-tableau-quick-tip
- **Watch:** https://www.youtube.com/watch?v=wC7wCtNh9Hg

I show you how to build long Tableau calculations efficiently by using VS Code's multi-line editing rather than writing 27 lines by hand. Using a mock surname-update dataset, I walk through pasting structured data from Excel, multi-cursor selection, and converting a CASE statement into an IF logic statement before dropping it back into Tableau.

## Key takeaways

- Pasting a column from Excel into VS Code keeps each value on its own line, so you don't have to count rows when building a long calculation
- Setting VS Code's language to SQL gives you familiar syntax formatting even though you're only using it as a text editor
- Multi-line cursor shortcuts (option+command+up on Mac) plus the End key let you insert WHEN, speech marks and values across every line at once
- Command+Shift+L selects all matching text, so you can swap every WHEN to ELSE IF in one go when converting CASE to IF logic
- This approach is the practical way to edit big logic statements when you're stuck on a published data source and can't just join in new values

## Chapters

- 0:00 The problem and setup
- 1:23 Why a manual edit is slow
- 1:56 Building a CASE statement in VS Code
- 5:12 Multi-line cursor editing tricks
- 7:03 Converting CASE to IF logic
- 9:05 Applying it in Tableau and wrap-up

Watch the full video, read the transcript and use chapter deep-links on the page: https://just-tim.com/posts/how-to-do-multi-line-calculations-and-edits-for-tableau-quick-tip

---
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
