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

Logical Operators

  • Equal to: a has the same value as b

  • Not equal to: a has a different value to b

  • And: Both of statements x and y are true

  • Or: Either of statements x and y is true

  • Not: Statement x is not true

Excel

Equal: =‹expression1›=‹expression2› Not equal: =‹expression1›<>‹expression2› And: =~AND!~(‹expression1›, ‹expression2›«, expressionN») Or: =~OR!~(‹expression1›, ‹expression2›«, expressionN») Not equal: =~NOT!~(‹expression›)

=A1=B1
=A1<>B1
=AND(A1,B1)
=OR(A1,B1)
=NOT(ISBLANK(A1))

Tableau

Equal: ‹expression1› = ‹expression2› Not equal: ‹expression1› != ‹expression2› And: ‹expression1› ~AND!~ ‹expression2› Or: ‹expression1› ~OR!~ ‹expression2› Not: ~NOT!~ ‹expression›

[Contract Type] = "Fixed"
[Country of Origin] != [Country of Operations]
[Tenure] < 10 AND AVG([Sales]) >= 50000
[Tenure] >= 10 OR AVG([Sales]) < 50000
NOT ISNULL([Name])

Alteryx

Equal: ‹expression1› = ‹expression2› Not equal: ‹expression1› != ‹expression2› And: ‹expression1› ~AND›~ ‹expression2› Or: ‹expression1› ~OR!~ ‹expression2› Not: ~NOT!~ ‹expression›

[Contract Type] = "Fixed"
[Country of Origin] != [Country of Operations]
[Tenure] < 10 AND AVG([Sales]) >= 50000
[Tenure] >= 10 OR AVG([Sales]) < 50000
NOT ISNULL([Name])

NB. The shorthand operators && (and), || (or) and ! (not) are also available.

OrgVue

Equal: ‹expression1› == ‹expression2› Not equal: ‹expression1› != ‹expression2› And: ‹expression1› && ‹expression2› Not equal: ‹expression1› || ‹expression2› Not: !‹expression›

node.contracttype.value == "Fixed";
node.countryoforigin.value != node.countryofoperations;
node.tenure < 10 && node.ad.sales.avg >= 50000;
node.tenure >= 10 || node.ad.sales.avg >= 50000;
!node.name.isblank

tSQL

Equal: ‹expression1› = ‹expression2› Not equal: ‹expression1› <> ‹expression2› And: ‹expression1› ~AND!~ ‹expression2› Or: ‹expression1› ~OR!~ ‹expression2› Not: ~NOT!~ ‹expression›

ContractType = "Fixed"
CountryOfOrigin <> CountryOfOperations
Tenure < 10 AND AVG(Sales) >= 50000
Tenure >= 10 OR AVG(Sales) < 50000
Name NOT NULL

NB. != can be used instead for 'not equal' but <> is considered good practice.

Python

Equal: ‹expression1› == ‹expression2› Not equal: ‹expression1› != ‹expression2› And: ‹expression1› ~and!~ ‹expression2› Or: ‹expression1› ~or!~ ‹expression2› Not: ~not!~ ‹expression›

contractType == "Fixed";
countryOfOrigin != countryOfOperations;
tenure < 10 and numpy.mean(sales) >= 50000;
tenure >= 10 or numpy.mean(sales) < 50000;
not name.isspace()
PreviousLogicalNextIf

Last updated 5 years ago

Was this helpful?

NB. The above example assumes variables have been declared for sales and name and that the numpy library has been imported. For more information, go to .

General > Variables