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

View all the Fabric Data Days sessions on demand. View schedule

Reply
Telstar
Helper I
Helper I

Segmentation/Binning/Grouping of measure then using it as a Legend or Axis in a graph - help please

Hi All

I have been tearing my hair trying to get to a required graphical visual (stacked column bar chart) for my data

I've trawled through the community, Powerbi sites etc but cannot seem to get any suggestion to work 

The main issue is getting (converting/using) a measure value as a legend or axis in a chart

 
I have 4 tables

DataTable

CompanyLoBTypeYearAmt
AA1RevenueFirst100
AA1ExpenseFirst50
AA2RevenueFirst125
AA2ExpenseFirst50
BA1RevenueFirst90
BA1ExpenseFirst50
BA3RevenueFirst25
BA3ExpenseFirst50
CA1RevenueFirst1000
CA1ExpenseFirst435
CA2RevenueFirst900
CA2ExpenseFirst450
CA5RevenueFirst4900
CA5ExpenseFirst2450
DA2RevenueFirst1000
DA2ExpenseFirst435
DA3RevenueFirst900
DA3ExpenseFirst450
DA4RevenueFirst1900
DA4ExpenseFirst1450
AA1RevenueSecond110
AA1ExpenseSecond55
AA2RevenueSecond137.5
AA2ExpenseSecond55
BA1RevenueSecond99
BA1ExpenseSecond55
BA3RevenueSecond27.5
BA3ExpenseSecond55
CA1RevenueSecond1100
CA1ExpenseSecond478.5
CA2RevenueSecond990
CA2ExpenseSecond495
CA5RevenueSecond5390
CA5ExpenseSecond2695
DA2RevenueSecond1100
DA2ExpenseSecond478.5
DA3RevenueSecond990
DA3ExpenseSecond495
DA4RevenueSecond2090
DA4ExpenseSecond1595

 

dimCountry

CountryCompany
AlphaA
AlphaB
BetaC
BetaD

 

dimBusiness 

BusinessLoB
RoadA1
RoadA3
RailA2
RailA4
AirA5

 

PMGroup  

PM% GroupMinMax
Top0.751000000
Middle0.250.75
Bottom-10000000.25

 

DataTable related to dimCountry on company

DataTable related to dimBusiness on Lob

 

From my data model/set I can calculate using measures 

Revenue = CALCULATE(SUM('DataTable'[Amt]), 'DataTable'[Type] IN { "Revenue" })

Expense = CALCULATE(SUM('DataTable'[Amt]), 'DataTable'[Type] IN { "Expense" })

Profit = [Revenue] - [Expense]

Profit Margin % = DIVIDE([Profit], [Expense],0)

Profit Margin Group = 

IF(ISBLANK([Profit Margin %])
,BLANK()
,CALCULATE(VALUES(PMGroupTable[PM% Group]),filter(PMGroupTable,PMGroupTable[Min] <=[Profit Margin %] && PMGroupTable[Max]>=[Profit Margin %]))
)

 

Now this is great to view the data via a matrix table or table BUT now i have a requirement to produce a stacked column bar chart where the Profit Margin Group is the legend, the Year is the axis and Profit is the value

 

So my issue is gettingthe Profit Margin Group as the graph legend 😞

The grouping for the bar chart is based on the grouping assigned at the Country and Business level.

 

I have a sample pbix file of the above but due to business contraints do not have somewhere to store it (no dropbox etc)

 

Also have screenshots but also no way of entering to here 😞


Any help greatly appreciated 
Cheers

Telstar

2 REPLIES 2
amitchandak
Super User
Super User

@Telstar , I have done segmentation on the margin on my data, Please find the video link and the attached file after the signature.

https://www.youtube.com/watch?v=CuczXPj0N-k&t=28s

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

Hi @amitchandak 

Thanksfor taking the time to comment and share the video/pbix file - very good instructional video.

 

However - - my requirement is grouping/binning the data at aggregated levels and then using that date to produce a stacked bar chart. From your example I cannot see how to group at my dimensional level and then use that information in a chart.

 

Still stuck on how to solve this 🤔

 

Cheers

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

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