Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes! Register now.

Reply
Anonymous
Not applicable

How to create a column for revenue bands that will aggregate based on slicer view?

Hi,

 

I am trying to create a column that groups revenue into bands, which will then be able to be used as slicers. I initially used this to create these revenue groupings:

 

each if [Revenue] <= 25000 then "Under 25K" else if [Revenue] >25000 and [Revenue] <50000 then "25K-30K" else if [Revenue] >50000 and [Revenue] <100000 then "50K-100K" else if [Revenue]>100000 and [Revenue] <250000 then "100K-250K" else null)

 

It worked when looking at each product individually, but when I would look at an aggregate view for customers or month, it would be inaccurate. See below:

will4444_0-1599686144999.png

 

 

How can I create a dynamic column for revenue groups that will automatically aggregate based off of month or customer?

1 ACCEPTED SOLUTION
v-yingjl
Community Support
Community Support

Hi @Anonymous ,

Create a single slicer table like this:

slicer.png

Create a sum total measure and a control measure, put the control measure in the visual filter and set its value as 1:

Total = 
CALCULATE (
    SUM ( 'Table'[Total Sales] ),
    ALLEXCEPT ( 'Table', 'Table'[Month], 'Table'[Customer] )
)

Control = 
VAR tab =
    ADDCOLUMNS (
        DISTINCT ( 'Slicer' ),
        "Min",
            SWITCH (
                [Slicer],
                "Under 25K", 0,
                "25K-30K", 25000,
                "50K-100K", 50000,
                "100K-250K", 100000
            ),
        "Max",
            SWITCH (
                [Slicer],
                "Under 25K", 24999,
                "25K-30K", 30000,
                "50K-100K", 100000,
                "100K-250K", 250000
            )
    )
RETURN
    IF (
        COUNTROWS ( FILTER ( tab, [Total] >= [Min] && [Total] < [Max] ) ) > 0,
        1,
        0
    )

tab.png

Attached a sample file in the below, hopes to help you.

 

Best Regards,
Yingjie Li

If this post helps then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

3 REPLIES 3
v-yingjl
Community Support
Community Support

Hi @Anonymous ,

Create a single slicer table like this:

slicer.png

Create a sum total measure and a control measure, put the control measure in the visual filter and set its value as 1:

Total = 
CALCULATE (
    SUM ( 'Table'[Total Sales] ),
    ALLEXCEPT ( 'Table', 'Table'[Month], 'Table'[Customer] )
)

Control = 
VAR tab =
    ADDCOLUMNS (
        DISTINCT ( 'Slicer' ),
        "Min",
            SWITCH (
                [Slicer],
                "Under 25K", 0,
                "25K-30K", 25000,
                "50K-100K", 50000,
                "100K-250K", 100000
            ),
        "Max",
            SWITCH (
                [Slicer],
                "Under 25K", 24999,
                "25K-30K", 30000,
                "50K-100K", 100000,
                "100K-250K", 250000
            )
    )
RETURN
    IF (
        COUNTROWS ( FILTER ( tab, [Total] >= [Min] && [Total] < [Max] ) ) > 0,
        1,
        0
    )

tab.png

Attached a sample file in the below, hopes to help you.

 

Best Regards,
Yingjie Li

If this post helps then please consider Accept it as the solution to help the other members find it more quickly.

Greg_Deckler
Community Champion
Community Champion

@Anonymous - That should have done it if you ended up with those values in a column in Power Query. You should just be able to use that column in a slicer and pick the right aggregation, Sum, Count, etc.

 

Are you saying that you need this dynamically so that you calculate the total with some additional filters and then decide what bucket it is in? You could do that with a disconnected table trick for your slicer In general, to use a measure in that way, you need to use the Disconnected Table Trick as this article demonstrates: https://community.powerbi.com/t5/Community-Blog/Solving-Attendance-with-the-Disconnected-Table-Trick/ba-p/279563



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...
amitchandak
Super User
Super User

@Anonymous , Do you need this on Aggregated values or Row level values. On row level you can use Switch and do.

On Aggregated values, you need to do binning and segmentation. In that case, you need an independent table and then create a formula using that. That table needs to have buckets with limits.

 

Refer if these example can help

https://www.daxpatterns.com/dynamic-segmentation/
https://www.daxpatterns.com/static-segmentation/
https://www.poweredsolutions.co/2020/01/11/dax-vs-power-query-static-segmentation-in-power-bi-dax-power-query/
https://radacad.com/grouping-and-binning-step-towards-better-data-visualization

 

 

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors
Top Kudoed Authors