Forum Discussion
DAX Count Unique Id when another column contains two values in different rows.
- 3 years ago
Hi Eparfitt1002
Could you please attach a table with an example of data and the desired results so that we can better understand your request? - 3 years ago
Eparfitt1002
In order to achieve the desired outcome.
The first step is to add a calculated column that concatenates the texts by ID to the "height"
Dax Funtion:Concatenated Text = CONCATENATEX(FILTER('Table', 'Table'[UniqueID] = EARLIER('Table'[UniqueID])), 'Table'[Tags], ", ")A second step involves counting based on whether the combination you are seeking is present.
DAX formula for a measureCounter = CALCULATE(DISTINCTCOUNT('Table'[UniqueID]),CONTAINSSTRING('Table'[Concatenated Text],"Escalated Client, Agent Expressed Empathy"))**If string order can also be reversed, you can add another comparison
with OR conditionIf this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi Eparfitt1002
Could you please attach a table with an example of data and the desired results so that we can better understand your request?
Certainly!
In the below example, I would want this formula to detect when Tags "Agent Expressed Empathy" and "Escalated Client" were both on the same call, and count the number of times that happens.
The below table would be a count of 1 when this happened on Call 4.
| UniqueID | Tags |
| Call 1 | Store Issue |
| Call 1 | Escalated Client |
| Call 2 | Billing Issue |
| Call 3 | Website Issue |
| Call 4 | Escalated Client |
| Call 4 | Agent Expressed Empathy |
| Call 5 | Billing Issue |
- Ritaf19833 years ago
Super User
Do you only check that combination?
- Eparfitt10023 years agoRegular Visitor
Right. I'm attempting to create a percentage that calculates how often my agents are using empathy during escalated calls.
So if it has the same UniqueID and those two values, it would count that call. Then I'll divide whatever that count is by the count of all the escalation calls to express it as a percentage.
Thanks!
- Ritaf19833 years ago
Super User
Eparfitt1002
In order to achieve the desired outcome.
The first step is to add a calculated column that concatenates the texts by ID to the "height"
Dax Funtion:Concatenated Text = CONCATENATEX(FILTER('Table', 'Table'[UniqueID] = EARLIER('Table'[UniqueID])), 'Table'[Tags], ", ")A second step involves counting based on whether the combination you are seeking is present.
DAX formula for a measureCounter = CALCULATE(DISTINCTCOUNT('Table'[UniqueID]),CONTAINSSTRING('Table'[Concatenated Text],"Escalated Client, Agent Expressed Empathy"))**If string order can also be reversed, you can add another comparison
with OR conditionIf this post helps, then please consider Accept it as the solution to help the other members find it more quickly.