0
votes

I am trying to build a report with Human Resources data. I've done it in Power Pivot and now I'm training in Power BI. I'm confused as how to achieve the following:

I have this sample table: table

And I'm building some measures to show in cards, referring to both genders: enter image description here

Orange is Male, Yellow is Female. The problem is that both Male and Female combined should be 100%, not 100% for each of them. If I put my measures in a matrix, and put Active Employees as "show value as % of Grand Total" it originates the values I need:

matrix

I'm messing up my measures. I'm pasting the measures for Female Employees here:

% Active Employees = 

VAR filterByTermDate = FILTER('HR Data';ISBLANK('HR Data'[TermDate]))

VAR calculateWithFilter = CALCULATE([Total Emp];filterByTermDate)

RETURN

calculateWithFilter
% Hourly F = 

VAR aux_filter = CALCULATE([Active Employees];FILTER('HR Data';'HR Data'[PayType]="Hourly"))

VAR dividendo2 = CALCULATE(aux_filter;FILTER('HR Data';'HR Data'[Gender]="F"))

VAR divisor = [Active Employees]

RETURN 

DIVIDE(dividendo2;divisor;0)
% Salary F = 

VAR aux_filter= CALCULATE([Active Employees];FILTER('HR Data';'HR Data'[PayType]="Salary"))

VAR dividendo = CALCULATE(aux_filter;FILTER('HR Data';'HR Data'[Gender]="F"))

VAR divisor = [Active Employees]

RETURN 

DIVIDE(dividendo;divisor;0)

Here is a sample file for one month only: http://www.filedropper.com/201501

Any help is appreciated. Thank you.

1
Your var dividendo makes no sense - aux_filter is a constant, you cant modify it with CALCULATE.RADO
Okay, should I apply both filters ("hourly" and "F") in the dividendo CALCULATE?Dreekun

1 Answers

0
votes

ANSWER: @RADO pointed me to the error. I was passing a wrong argument to CALCULATE. It seems to work if I just add both filters to dividendo's CALCULATE:

% Hourly F = 

VAR dividendo = CALCULATE([Active Employees];FILTER('HR Data';'HR Data'[Gender]="F");FILTER('HR Data';'HR Data'[PayType]="Hourly"))

VAR divisor = [Active Employees]

Return DIVIDE(dividendo2;divisor;0)

enter image description here