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 August 31st. Request your voucher.
I am working with some survey data.
I have a matrix that shows the row total calculating the % split between job roles. Then the % of responses based on the entire dataset. I want to show the % by job role.
For example, 25% respondants were teachers, the following % for the responses should total 100% not 25%.
Solved! Go to Solution.
Hi @Aimeeclaird ,
Try this:
Jan % Responses 2 =
VAR JobRole_ =
CALCULATE (
COUNTROWS ( 'Combined W/out Overall Trust' ),
FILTER (
ALLEXCEPT (
'Combined W/out Overall Trust',
'Combined W/out Overall Trust'[Job Role]
),
'Combined W/out Overall Trust'[Survey Cycle] = "January Data"
)
)
VAR All_ =
CALCULATE (
COUNTROWS ( 'Combined W/out Overall Trust' ),
FILTER (
ALL ( 'Combined W/out Overall Trust' ),
'Combined W/out Overall Trust'[Survey Cycle] = "January Data"
)
)
VAR Response_ =
COUNTROWS ( 'Combined W/out Overall Trust' )
RETURN
SWITCH (
TRUE (),
HASONEFILTER ( 'Combined W/out Overall Trust'[Response] ), DIVIDE ( Response_, JobRole_ ),
HASONEFILTER ( 'Combined W/out Overall Trust'[Job Role] ), DIVIDE ( JobRole_, All_ ),
1
)
And I have create a simple sample for reference:
Best Regards,
Icey
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @Aimeeclaird ,
Try this:
Jan % Responses 2 =
VAR JobRole_ =
CALCULATE (
COUNTROWS ( 'Combined W/out Overall Trust' ),
FILTER (
ALLEXCEPT (
'Combined W/out Overall Trust',
'Combined W/out Overall Trust'[Job Role]
),
'Combined W/out Overall Trust'[Survey Cycle] = "January Data"
)
)
VAR All_ =
CALCULATE (
COUNTROWS ( 'Combined W/out Overall Trust' ),
FILTER (
ALL ( 'Combined W/out Overall Trust' ),
'Combined W/out Overall Trust'[Survey Cycle] = "January Data"
)
)
VAR Response_ =
COUNTROWS ( 'Combined W/out Overall Trust' )
RETURN
SWITCH (
TRUE (),
HASONEFILTER ( 'Combined W/out Overall Trust'[Response] ), DIVIDE ( Response_, JobRole_ ),
HASONEFILTER ( 'Combined W/out Overall Trust'[Job Role] ), DIVIDE ( JobRole_, All_ ),
1
)
And I have create a simple sample for reference:
Best Regards,
Icey
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
@Aimeeclaird Have you looked at the options for Percent of Grand Total, Percent of Column Total, etc.?
Solved: How To Display Percentage of Total - Microsoft Power BI Community
I have and unfortunately it isn't doing what I need. Not sure if it my Measure?