1

I am relatively new to tableau and I am trying to replicate a sumif as a calculated field in tableau. I have seen posts online where you can use SUM(IF [Broker] = "Broker1" then [settleamount] end) as a way to replicate SUMIFS($Q:$Q, $R:$R = "Broker1") where Q is the column for settleamount and column R is the broker column.

How would you replicate the following in sumifs in tableau? SUMIFS($Q:$Q, $R:$R = R2) and then for R3, R4 and each value of column R (I would autofill the formula in excel to populate for all rows).

monkey1009
  • 11
  • 2

1 Answers1

0

There are a few approaches to replicating Excel's SUMIF function, my preferred approach is to use the function INT() which converts its argument to an integer, along with the aggregation function SUM(). This trick takes advantage of the fact that when the argument is a boolean expression, INT() converts True to 1 and False to 0.

So SUM(INT([Broker] = "Broker 1")) returns the number of records that satisfy the supplied condition, i.e. where the broker was Broker 1.

Alex Blakemore
  • 11,301
  • 2
  • 26
  • 49