'How to create sales buckets in dax/powerbi?

I have a table like so:

Client   Sales

Julie    $100
Alex     $1000
Ben      $500

I want to create two sales buckets, 0-100$ and 100-1000$. I want to create a table that organizes the above data like so:

Bucket      Total Sales
0-100$        $100
100-1000$     $1500

I am new to dax and I am at a loss on how to do this. This is what I have so far but it isn't spitting out the expected result:

sales = SWITCH (
         TRUE,
         'salestable'[sales]<= 100, 'salestable'[sales],
         'salestable'[sales] > 100 && <= 1000, 'salestable'[sales],
)

Any help is much appreciated!



Solution 1:[1]

You need a calculated column or a measure lets create a calculated column inside the table as below. I suggest you to create a calculated column.

sales bucket = 
IF (
    'Sales Targets'[Target] <= 1000
        && 'Sales Targets'[Target] > 100,
    "100-1000$",
    IF ( 'Sales Targets'[Target] <= 100, "0-100$", BLANK () )
)

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 AmilaMGunawardana