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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
Anonymous
Not applicable

How to create entry for filter using CONTAINSSTRING function

I have the following fliter to determine the number of students enrolled in the following periods, "Fall", "Spring" and "Summer".

 

VAR _enrollmentcount = CALCULATE(COUNTROWS(Enrollment),
All(Enrollment[Deposit Intent to Enroll Date/Time]),
Enrollment[Deposit Intent to Enroll Date/Time] >= _startdate
&& Enrollment[Deposit Intent to Enroll Date/Time] <= _enddate,
FILTER('Enrollment',CONTAINSSTRING('Enrollment'[Start Term and Year], _section)))

 

I would like to be able to updated he variable _ section with the appropriate period.  I need to do this since the CONTAINSSTRING function requires quotes around the period name.

 

If I add the period name then the filter runs fine.

 

VAR _fallcount =If( _iterm = "Fall",
(CALCULATE(COUNTROWS(Enrollment),
All(Enrollment[Deposit Intent to Enroll Date/Time]),
Enrollment[Deposit Intent to Enroll Date/Time] >= _startdate
&& Enrollment[Deposit Intent to Enroll Date/Time] <= _enddate,
FILTER('Enrollment',CONTAINSSTRING('Enrollment'[Start Term and Year], "Fall"))))
)

 

My question is how to get quotes around the period name and how to successly implement the substution logic.

 

I appreciate everyones assistance.

 

0 REPLIES 0

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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