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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
tscongack
Regular Visitor

How do I add a current year filter with text filter

Hi there,

 

I'm attempting to add multiple filters to a column, along with one that takes the year out of a date field and returns values that equal the current year.

 

Each text filter I'd like it to act as "or" or return if any of the conditions are met

 

Current in 2017 = CALCULATE(COUNTROWS(EmployeeRecord),EmployeeRecord[Status] = "Active", EmployeeRecord[Status] = "On Leave - Parental", EmployeeRecord[Status] = "On Leave - Unpaid", EmployeeRecord[Status] = "On Leave - Long Term Disability"), (Year(EmployeeRecord[Termination Date]) = (Year[Today])

 

I'm not sure how to make a filter that selects entries that contain "On Leave"  - is there a way to do this as well?

 

Thanks in advance for your help!

3 REPLIES 3
v-jiascu-msft
Microsoft Employee
Microsoft Employee

Hi @tscongack,

 

Could you please mark the proper answer as solution or share the solution if it's convenient for you? That will be a big help to the others.

 

Best Regards!
Dale

Community Support Team _ Dale
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
v-jiascu-msft
Microsoft Employee
Microsoft Employee

Hi @tscongack,

 

1. You want to add a year condition. Maybe you can try it like this:

Current in 2017 =
CALCULATE (
    COUNTROWS ( EmployeeRecord ),
    FILTER (
        EmployeeRecord,
        EmployeeRecord[Status]
            IN {
                "Active",
                "On Leave - Parental",
                "On Leave - Unpaid",
                "On Leave - Long Term Disability" }
            || YEAR ( EmployeeRecord[Termination Date] ) = YEAR ( TODAY () )
    )
)

BTW, the conditions organized in your format will be applied with "AND".

 

2. Filter conditions of containing "On Leave", you can try this one. Refer to SEARCH.

Current in 2017 =
CALCULATE (
    COUNTROWS ( EmployeeRecord ),
    FILTER ( EmployeeRecord, SEARCH ( "On Leave", EmployeeRecord[Status], 1, 0 ) )
)

Best Regards!

Dale

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

Hi,

 

I'd suggest that you create a calendar table wih running dates there.  In that calendar table, extract the year from the Date column using =YEAR(Calendar[Date]).  Create a relationship from the Termination Date of the EmployeeRecord table to the Date column of the calendar table.  Drag year from the calendar table to yuor visual.  Now try this formula

 

=CALCULATE(COUNTROWS(EmployeeRecord),FILTER(EmployeeRecord,

EmployeeRecord[Status] = "Active"||EmployeeRecord[Status] = "On Leave - Parental"||EmployeeRecord[Status] = "On Leave - Unpaid"||EmployeeRecord[Status] = "On Leave - Long Term Disability"))

 

Hope this helps.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors
Top Kudoed Authors