Forum Discussion
OPS-MLTSD
Post Patron
4 years agoDAX equivalent to %LIKE% in sql - to count IDs
Hello, I am trying to do a simple count in Power BI using dax. In sql, I would simply use this function to pull my data: Select count (distinct Client_ID) Client_ID from table Where st...
davehus
Memorable Member
4 years agoTry this.
CALCULATE(
COUNT(clients[CLIENT_ID]),Filter(
SEARCH("University",clients[School],1,0) > 0&&clients[start_date]>= '2021-03-16'))
OPS-MLTSD
Post Patron
4 years agothank you, for some reason, this is not working for me, I copied and pasted this exact dax
- hnguy714 years ago
Super User
Hi OPS-MLTSD ,
You may be trying to compare a date field against a string value. This should work:
CALCULATE( COUNT(clients[CLIENT_ID]), SEARCH("UNIVERSITY", clients[School], 1, 0) > 0, clients[start_date] >= DATE(2021, 03, 16) )- OPS-MLTSD4 years ago
Post Patron
it worked! thank you so much 🙂
- OPS-MLTSD4 years ago
Post Patron
hnguy71 quick question, what is I wanted to search of two items, "Unniversity" and "College"? Would I use something like this?
CALCULATE( COUNT(clients[CLIENT_ID]), OR(SEARCH("UNIVERSITY", "College", clients[School], 1, 0)) > 0, clients[start_date] >= DATE(2021, 03, 16) )