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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Manudata
Frequent Visitor

Segment based on a meausre and used as filter?

 

Hello, I am unable to solve this (with other tools I know how to do it, but with PBI I don't see a way).

 

I have a list of invoices, year, customer name, sales and margin amounts.

I want to know the margin percentage of each client and then group them into segments (margin <30%, margin 30-60%, margin 60-100%)

Then represent the number of customers for each segment (in a pie chart for example) and you can click on the pie and the list with that segment is filtered

 

The main problem is:

- If I create measures to calculate customers by segment, that measure does not filter a list
- If I use calculated columns, they are not recalculated if I later use a filter on the screen

 

Any ideas?

 

 

pbix with sample data

https://drive.google.com/file/d/1QBuuQ6IvqbcPoLNxZThxl6SfmW_Xnzyi/view?usp=sharing

 

 

1111.png



5 REPLIES 5
Manudata
Frequent Visitor

any ideas?

Anonymous
Not applicable

Hi,

Thanks for the solution SamWiseOwl  offered, and i want to offer some more information for user to refer to.

hello @Manudata , you can refer to the following sample.

1.Create a range measure.

Range =
SWITCH (
    TRUE (),
    [% margin] >= 0
        && [% margin] < 0.25, "0-25%",
    [% margin] >= 0.25
        && [% margin] < 0.5, "25%-50%",
    [% margin] >= 0.5
        && [% margin] < 0.75, "50%-75%",
    "75%-100%"
)

2.Then create a range table.

vxinruzhumsft_0-1732846023666.png

3.Then create a measure.

Measure = COUNTROWS(FILTER(Tabla,[Range] in VALUES('Table'[Margin_range])))

4.Put the following field to the pie chart visual.

vxinruzhumsft_1-1732846076486.png

 

Output

vxinruzhumsft_2-1732846098385.png

 

Best Regards!

Yolo Zhu

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

Hi, this solutions works only for donut chart, but it does not allow clicking on the donut to filter the list (expected because the measurements do not allow filtering other objects)

SamWiseOwl
Super User
Super User

Hi @Manudata 

You can create a table using Enter data and enter the definition of the bandings.

SamWiseOwl_1-1732799846745.png

 

Then use this to group and count the items that fall into the different categories.

SamWiseOwl_0-1732799978931.png

Create a measure that uses this in the pie chart.

Count values =
var big = SELECTEDVALUE(Bandings[Max])
var small = SELECTEDVALUE(Bandings[Min])

RETURN
 COUNTX(Filter(Tabla, [% margin]*100 <= big &&[% margin]*100 >= small),[customer])

 


If you are happy with this answer please mark as a solution for others to find !

Kudos are always appreciated! Check out our free Power BI video courses.

This solution not allow clicking on the donut to filter the list (expected because the measurements do not allow filtering other objects)

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 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.