Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
Hi,
I'm looking for some advice on how I can create a measure that counts the number of customers that do not have a specific event recorded against them. An example of this is:
I would like to create a calculation which searches for specific text in the Customer Notes table and then filters the Customer Count measure to include Customers that don't have the search string in a Customer Note.
I've tried doing it the other way round first, calcualting the customer count that does have a specific text in a note, but I'm not having much luck:
Missing Fee Note =
CALCULATE(
[Customer Count],
FILTER ( Customer, CONTAINSSTRING ( 'Customer Note'[Note Text], "search text" ) )
I get an error above which says that it can't determine a single value. Any help or pointers would be appreicated.
Thanks
Solved! Go to Solution.
@DavidC2020 , make sure Customer Count is a measure
Try like example
CALCULATE(
count(Sales[Customer ID]) ,
FILTER ( Customer, not CONTAINSSTRING ( 'Customer Note'[Note Text], "search text" ) ) //added not , remove as per need
Hi @DavidC2020 ,
You can try the following methods.
Here's my test table:
Customer Note Table:
Customer Table:
Sales Fact Table:
Measure:
Missing Fee Note =
CALCULATE (
[Customer Count],
FILTER (
ALL ( 'Customer Note' ),
CONTAINSSTRING ( 'Customer Note'[Note Text], "fail" )
)
)
In your code, the first argument to the filter function should probably be used Customer Note.
Missing Fee Note =
CALCULATE(
[Customer Count],
FILTER ( Customer, CONTAINSSTRING ( 'Customer Note'[Note Text], "search text" ) )
Is this the result you expect?
Best Regards,
Community Support Team _Yinliw
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Thank you for the example. I was looking for instances where the text was not contained within the string.
@DavidC2020 , make sure Customer Count is a measure
Try like example
CALCULATE(
count(Sales[Customer ID]) ,
FILTER ( Customer, not CONTAINSSTRING ( 'Customer Note'[Note Text], "search text" ) ) //added not , remove as per need
User | Count |
---|---|
25 | |
11 | |
8 | |
6 | |
6 |
User | Count |
---|---|
27 | |
13 | |
11 | |
9 | |
6 |