The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends September 15. Request your voucher.
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"
User | Count |
---|---|
15 | |
13 | |
8 | |
6 | |
6 |
User | Count |
---|---|
27 | |
19 | |
13 | |
9 | |
5 |