Next, we are going to look at a DAX pattern that can be used to create a calculated column to segment data into different groups. Typical examples include age groups, product groups, and price banding. This process is also known as value binning, and it is particularly useful when you want to visualize data using histograms.
In this example, we are going to create a new column in the Products table that will group products based on the value of the Unit Price field.
The following code is the DAX expression for the new calculated column:
Unit Price Segment =
SWITCH (
TRUE (),
'Product'[Unit Price] < 100, "0-99",
'Product'[Unit Price] < 200, "100-199",
'Product'[Unit Price] < 300, "200-299",
'Product'[Unit Price] < 400, "300-399",
'Product...