Forum Discussion
Wildcard characters in filter expression
Hello,
I have a table including all the students enrolled in a university course, and need to obtain the number of those who attended certain schools (identified by the prefix "school").
To do so, all I need is to FILTER the "SchoolName" field inside a CALCULATE expression, in order to count only those values starting with the word "school", adding an asterisk as a wild character after the word "school".
Therefore I wrote the following:
giovissimo there is no concept of wildcard, you can do something like this
Students = CALCULATE([Students], FILTER(ALL(Course[SchoolName]),LEFT(Course[SchoolName],5)="School")) Students = CALCULATE([Students], FILTER(ALL(Course[SchoolName]),CONTAINSSTRING(Course[SchoolName],"School"))Check my latest blog post Compare Budgeted Scenarios vs. Actuals I would ❤ Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos to whoever helped to solve your problem. It is a token of appreciation!
⚡Visit us at https://perytus.com, your one-stop-shop for Power BI-related projects/training/consultancy.⚡
2 Replies
- parry2k
Super User
giovissimo there is no concept of wildcard, you can do something like this
Students = CALCULATE([Students], FILTER(ALL(Course[SchoolName]),LEFT(Course[SchoolName],5)="School")) Students = CALCULATE([Students], FILTER(ALL(Course[SchoolName]),CONTAINSSTRING(Course[SchoolName],"School"))Check my latest blog post Compare Budgeted Scenarios vs. Actuals I would ❤ Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos to whoever helped to solve your problem. It is a token of appreciation!
⚡Visit us at https://perytus.com, your one-stop-shop for Power BI-related projects/training/consultancy.⚡
- giovissimo
Helper I
Thank you very much !