Starting December 3, join live sessions with database experts and the Microsoft product team to learn just how easy it is to get started
Learn moreGet certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now
Dear community,
I am looking for a solution to count the amount of a certain text value occurs in a column. This sounds super simple, however I tried multiple formulas and my measure keeps returning blank. these formulas i tried and didn't work:
=DISTINCTCOUNT([Why did the employee decide to leave], "Job/Role") // not working
CALCULATE
(COUNTROWS('Exit interviews'),
'Exit interviews'
[Why did the employee decide to leave] = " Job/Role ") // not working
I have a dataset containing information on exit interviews. For some questions, participants can fill out multiple answers which results in one or multiple text strings in one column, delimited by " ; ". For all the leaving reasons in that column, I want to count them to be able to display them in a graph. Here is what the column looks like:
I hope someone can tell me how to do this, or what i was doing wrong!
many thanks in advance 🙂
Solved! Go to Solution.
@Anonymous .
First thing is you want to use COUNTA (used to Count Text Values) not DISTINCTCOUNT. The way you are using DistinctCount will always give a 1.
Next, in your Filter context, it is looking for an exact string. Your text value contains a semi-colon and hence PBI is saying it is not a match. To account for this, use CONTAINSSTRING:
Containsstring = CALCULATE( COUNTA( ExitInterviews[Reason] ),
FILTER( ExitInterviews, CONTAINSSTRING( ExitInterviews[Reason], "Job/Role" )))
The other thing you may want to consider is using Power Query to split your Columns by Delimiter. Use the advanced functions to "Split into Rows". Then you get all your Reasons individually by Row.
Hope this helps.
Regards,
@Anonymous .
First thing is you want to use COUNTA (used to Count Text Values) not DISTINCTCOUNT. The way you are using DistinctCount will always give a 1.
Next, in your Filter context, it is looking for an exact string. Your text value contains a semi-colon and hence PBI is saying it is not a match. To account for this, use CONTAINSSTRING:
Containsstring = CALCULATE( COUNTA( ExitInterviews[Reason] ),
FILTER( ExitInterviews, CONTAINSSTRING( ExitInterviews[Reason], "Job/Role" )))
The other thing you may want to consider is using Power Query to split your Columns by Delimiter. Use the advanced functions to "Split into Rows". Then you get all your Reasons individually by Row.
Hope this helps.
Regards,
It worked, thank you for the explanation! 🙂
Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.
User | Count |
---|---|
90 | |
87 | |
84 | |
68 | |
49 |
User | Count |
---|---|
131 | |
111 | |
96 | |
71 | |
67 |