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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
corange
Post Patron
Post Patron

Measure not filtering by region

Hi everyone, 

 

My objective is to calculate the Turnover Rate and for this measure to update when I select a specific region. 

 

I have set up the following formulas: 

 

(1) This measure give me the number of active employee at any time. I have selected FY to display my data. 

 

Employee Count =
VAR MaxDate = MAX('Calendar'[Date])
VAR EMPCOUNT =
CALCULATE(COUNTROWS(CALCULATETABLE(Drivers, Drivers[StartDate] <= MaxDate, ALL ('Calendar'[Date]))),
(ISBLANK(Drivers[FinishDate])|| Drivers[FinishDate] > MaxDate))
RETURN IF(ISBLANK(EMPCOUNT), 0, EMPCOUNT)

 

(2) This measure allows me to obtain the employee count 12 month before today 

 

Count 12 months before =
VAR SelectDate = NEXTDAY(SAMEPERIODLASTYEAR(LASTDATE('Calendar'[Date])))
RETURN
SUMX(Employee,
VAR EmpStartDate = [StartDate]
VAR DriverFinishDate = [FinishDate]
RETURN IF (EmpStartDate < SelectDate && OR(EmpFinishDate >= SelectDate, EmpFinishDate = BLANK ()),1,0))
 
(3) This allows me to obtain the number of employees who left within the year
 
Left past 12 months =
VAR selectedDate = LASTDATE('Calendar'[Date])
VAR selectedDate12MonthsBefore = NEXTDAY(SAMEPERIODLASTYEAR(selectedDate))

RETURN
SUMX(Emp,
  IF([FinishDate]>=selectedDate12MonthsBefore && [FinishDate]<=selectedDate, 1, 0)
)
 
(5) Using the above measures, I sum them up into one to get the turnover rate
 
Turnover % =
VAR averageEmployeesRolling12months = ([Employee Growth]+[Count 12 months before])/2

RETURN
[Left past 12 months]/ averageEmployeesRolling12months
 
The thing now is that I have a map with the regions and I would like for the turnover % measure to update when I click on a region. My metric displays 0.00%.
 
Did I miss something ? Does the formula looks correct to you and how can I have it updated when selecting a region?
 
Thank you in advance.
2 REPLIES 2
corange
Post Patron
Post Patron

 I In addition to that, if I apply the filter region to the visual itself, it will update accordingly. 

 

However, if I click on the region from the map visual, the metric doesnt update. Any idea? Capture.PNG

hi @corange 

If possible could you please share a simple sample pbix file for us have a test, it will be great help.

Please see this post regarding How to Get Your Question Answered Quickly:
https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490

 

Regards,

Lin

Community Support Team _ Lin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.