How to calculate sum of distinct values in Tableau?
- Tableau FAQs
- December 11, 2018
You can calculate the sum of distinct values in Tableau with the easy steps below. As a bonus, you get an easy step-by-step video alternative on how to do it on Datameer.
Deserts First – The Datameer Alternative to Calculating Sum of Distinct Values in a Dataset
In Datameer, calculating the sum of distinct values is as simple as using Datemeer’s SQL query and functions. This is described below:
Select SUM(DISTINCT TOTAL_ORDERS) AS SUM_OF_ORDERS
From ORDERS
Here’s a quick description of this function:
DISTINCT – This function will select only distinct total orders
SUM () – This sums the distinct orders calculated previously.
Here’s a short video that shows you how to get it done in 2 minutes
Calculating sum of distinct values of a dataset using Tableau
Although the steps are slightly less simple, you can also calculate the sum of distinct values on Tableau using the function given below:
SUM({FIXED [ProductID],[DueDate]: AVG([OrderQty])})
SUM() – this function will sum the result of the expression
{FIXED [ProductID],[DueDate]: – here we indicate the level of detail you can use any other in your data
AVG([OrderQty]) – averaging within each ProductID and DueDate will eliminate the duplicates in your sum
Up Next:
Read How do I create a variable with a logical function like IN or INLIST in Tableau?