Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now
I have a tabble called D_events, I want to create a clustered bar chart that will be as follows
Y axis: % of reasons count
X axis: Reason
Legend: Year
I need to create a measure for ' % of reasons count' that will be sliced by Date, Class, Section which are available in the same table.
I created this measure which shows the % correctly only if im not slicing. for example if the data has 1 'reason' in 2020 out of the total of 2 reasons in 2020 it should calculated 1/2 but instead its calculating everything regardless of whats in the legend, x-axis.
VAR SelectedReason = SELECTEDVALUE('D_Events'[Reason])
RETURN
DIVIDE(
CALCULATE(COUNTROWS('D_Events'), 'D_Events'[Reason] = SelectedReason),
CALCULATE(COUNTROWS('D_Events'), ALLSELECTED('D_Events'))
)
What adjustments I need to make to make this work the way it should be?
Hi @Mclovin100
please try
=
DIVIDE (
COUNTROWS ( 'D_Events' ),
CALCULATE ( COUNTROWS ( 'D_Events' ), ALLSELECTED ( 'D_Events'[Reson] ) )
)
Its not working as expected
for example in my clustred bar chart I have one class value that should be %100 because its the only value in x axis and happened once in 2021, and the legened is for the year which is the 2021. Then it should show %100 but now its showing 8% because its looking at other "dates"
Check out the November 2025 Power BI update to learn about new features.
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!
| User | Count |
|---|---|
| 9 | |
| 7 | |
| 6 | |
| 6 | |
| 5 |
| User | Count |
|---|---|
| 24 | |
| 21 | |
| 17 | |
| 14 | |
| 13 |