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
  • Excel
  • Tableau
  • Alteryx
  • OrgVue
  • tSQL
  • Python

Was this helpful?

  1. General

Variables

PreviousLookup/JoinNextConvert Type

Last updated 5 years ago

Was this helpful?

Excel

Select a cell/range of cells > go to the Formulas tab > Defined Names > Name Manager (or hold Ctrl+F3) and assign a name to the selected cell. In the future, you can refer to the value of the cell/cells by typing the chosen name.

Tableau

Right-click in the Data Window > Create Parameter. In the popup, provide a parameter name and specify (a) the data type for the values it will accept, (b) the current value, and (c) input options.

Alteryx

Use the Parameter Control tool (in the Input palette), which acts as the input for each iteration of a Batch Macro and will appear as a ¿ on the macro tool icon.

NB. The Control Parameter must have an Action associated with it, such as Update Value, Update Input, or Update Output Actions. For each record coming into the Control Parameter input, the entire macro will be re-configured and run beginning to end.

OrgVue

var ‹variable_name› = ‹expression›

// Variables
var a = 1;
var sal = node.salary;
var nv = node.value;

// Uses
a == 2; // Returns 'true'
sal*1.2
nv['Bonus'];

NB. Consider the different uses of the = symbol. In this case:

  • a = 2 assigns the value '2' to the variable 'a'

  • a == 2 tests the equality of 'a', ie returns 'True' if 'a' equals '2'

  • a === 2 tests the identity of 'a', which in this case will return 'False' because, although 'a' and '2' have the same value, they are different entities.

tSQL

~DECLARE!~ ‹parameter_name› «type» ~SET!~ ‹parameter_name› = ‹expression›

DECLARE EmpIDVar INT
SET EmpIDVar = 1234

SELECT *
FROM EmployeesData
WHERE EmployeeID = EmpIDVar

Python

‹variable_name› = ‹expression›

a = 1;
salary = 100000;
comp = salary*1.2;