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
Anonymous
Not applicable

Add another filter to a measue

Hi

 

I am doing some calculations of headcount by tenure and need help.

 

The below measure is one succesfully created to tell me what is the active start of month headcout by month.

 

Active SOM HC by Month = CALCULATE(COUNTROWS('common DimEmployee'),filter('common DimEmployee','common DimEmployee'[StartDate]<= STARTOFMONTH('common vwDimDate'[Date])&&'common DimEmployee'[End Date Adjusted]>=STARTOFMONTH('common vwDimDate'[Date])))

 

I am keeping this measure but want to create a new measure that adds another filter to above. I need the active start of month headcount by month for employees with less than 1 years tenure. It need to be a snapshot in time. So basically the 'common DimEmployee'[StartDate] field needs to be within a year of the 'common DimDate'[Date] I am dimensioning against.

 

I have tried various options previousyear function, datesinperiod function etc without any success.

1 ACCEPTED SOLUTION
v-caliao-msft
Employee
Employee

@Anonymous,

 

You could add another filter to your measure.
Active SOM HC by Month =
var today = TODAY() 

return CALCULATE(COUNTROWS('common DimEmployee'),filter('common DimEmployee','common DimEmployee'[StartDate]<= STARTOFMONTH('common vwDimDate'[Date])&&'common DimEmployee'[End Date Adjusted]>=STARTOFMONTH('common vwDimDate'[Date])&&1*(today-'common DimEmployee'[StartDate])<365))

 

Regards,

Charlie Liao

View solution in original post

1 REPLY 1
v-caliao-msft
Employee
Employee

@Anonymous,

 

You could add another filter to your measure.
Active SOM HC by Month =
var today = TODAY() 

return CALCULATE(COUNTROWS('common DimEmployee'),filter('common DimEmployee','common DimEmployee'[StartDate]<= STARTOFMONTH('common vwDimDate'[Date])&&'common DimEmployee'[End Date Adjusted]>=STARTOFMONTH('common vwDimDate'[Date])&&1*(today-'common DimEmployee'[StartDate])<365))

 

Regards,

Charlie Liao

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.