Working with Data: All the calculations you need t
  • Introduction
  • What is this book?
  • How to Use this Book
  • Document Notes
  • Authors' Thanks
  • Strings
    • Concatenate
    • Split
    • Length
    • Slice
    • Trim
    • Contains
    • Match
    • Replace
    • Upper/Lower Case
  • Numbers
    • Sum
    • Average
    • Roll Ups
    • Round
    • Floor
    • Power
    • Square Root
    • Absolute
  • Dates
    • Date Difference
    • Age
  • Logical
    • Logical Operators
    • If
    • Case / Switch
    • Is Null/Empty
  • General
    • Count
    • Filter
    • Sort
    • Lookup/Join
    • Variables
    • Convert Type
  • Appendix
    • DateTime Parts
    • Helpful Resources
Powered by GitBook
On this page
  • Structure
  • Syntax conventions
  • Colour
  • Example Code Snippets
  • Case Sensitivity
  • Conventions and Other Guidance

Was this helpful?

How to Use this Book

PreviousWhat is this book?NextDocument Notes

Last updated 5 years ago

Was this helpful?

Structure

As we said in the introduction, we have split this book into 5 main sections. The first three (, and ) correspond to different types of data, and the last two contain types of operations, either calculations or more options which don't depend on data type (e.g. filtering).

Each page describes a specific calculation in one of those categories, and for each of the six tools we have provided:

  • Model syntax

  • One or more Examples of the syntax in action

  • A collection of User Notes where we think the syntax in question is difficult or extensive, or if a tool has unusual or default behaviour.

Syntax conventions

Colour

We have refrained from using characters, e.g. [], to highlight different parts of an expression like optional arguments. This is to avoid confusion between alternate conventions and to account for the fact that most commonly used characters mean different things in different tools: [] surround field names in Tableau but arrays in OrgVue and sets in Python.

Instead, we use consistent colour coding in model syntax so you know how to interpret each part of the expression.

  • ~Functions!~ (the syntax required by the tool) are written in blue

  • ‹User inputs› (whether individual values or references to fields) are written in orange

  • «Optional inputs» (which can be excluded from the function) are written in purple. Check the individual tool notes for the behaviour of the function when optional inputs are omitted.

Example Code Snippets

Within examples, we have represented code as you would expect to see it in the tool in question. This means that comments are flagged differently. You can tell a comment as any line beginning with // in Tableau, Alteryx and OrgVue examples, with -- in tSQL examples, or with # in Python examples. Expected results are included for clarity wherever possible.

Case Sensitivity

In all tools except OrgVue and Python, functions are not case sensitive; we provide examples in CAPS by convention but you can write them in mixed case. OrgVue's expression language (Gizmo) and Python are case sensitive so must be written as provided.

Conventions and Other Guidance

  • Not all functions are available in all tools. Whether a feature is available depends on (a) the purpose, and (b) the design of each tool. For example, Tableau and Alteryx let you define parameters through the user interface (UI) whereas in Python and SQL these need to be declared with code. Cases where a function is not available in one tool, or a workaround is needed, are explained in the Use Notes.

  • We do not distinguish between certain terms. Although not equivalent, strictly speaking, we use "expression", "formula", and "calculation" interchangeably to mean the whole code snippet which aims to return an answer. We also do not distinguish between "function" and "method", and use both to refer to individual functions available.

    e.g. ~IF!~() and ~ISBLANK!~() are both functions, ~IF!~(‹a›,‹b›,‹c›) and ~ISBLANK!~(‹x›) are expressions.

Strings
Numbers
Dates
Logical
General