KNOWLEDGE BASE

How to Create a Customized Simulated Histogram Bin Using Calculation Fields


Published: 01 Nov 2023
Last Modified Date: 01 Nov 2023

Question

How to use a calculation field to create a simulated histogram bin to group data in a custom manner.

 

Environment

  • Tableau Desktop

Answer

When connecting to data such as the Superstore.xlsx file, it is possible to group and count the number of records with a Sale between 0~500, 500~1000,1000~1500 and 1500~ using a calculation demonstrated below.

This example is a simulated bin which has a size of 500:

IF [Sales]>=0 AND [Sales]<500 THEN "0~"
ELSEIF [Sales]>=500 AND [Sales]<1000 THEN "500~"
ELSEIF [Sales]>=1000 AND [Sales]<1500 THEN "1000~"
ELSE "1500~"
END



User-added image

Please review the packaged example workbook located in the Attachments section - Sample-bin.twbx.
Did this article resolve the issue?