Forum Discussion
Return text value from column A when contains different values in column B.
Hi
I am new to DAX and I need to return the value from column A (in this case X23) because it contains different values in column B.
Please see the table below:
| A | B |
| X23 | D566 |
| X23 | D555 |
| X15 | D566 |
| X14 | D566 |
| X18 | D555 |
| X18 | D555 |
Hi AndreaSo ,
You can try below formula:
Result = VAR a = COUNTROWS ( FILTER ( ALL ( 'Table' ), 'Table'[A] = MAX ( 'Table'[A] ) ) ) VAR b = COUNTROWS ( FILTER ( ALL ( 'Table' ), 'Table'[A] = MAX ( 'Table'[A] ) && 'Table'[B] = MAX ( 'Table'[B] ) ) ) RETURN IF ( a = b, "black" ,"red")If the problem is still not resolved, please provide detailed error information and let me know immediately. Looking forward to your reply.
Best Regards,
Henry
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
2 Replies
- lbendlin
Super User
In a table visual add columns A and B. Change the aggregation for B to Count (Distinct). Apply a visual filter where that value has to be greater than 1.
- v-henryk-mstf
Community Support
Hi AndreaSo ,
You can try below formula:
Result = VAR a = COUNTROWS ( FILTER ( ALL ( 'Table' ), 'Table'[A] = MAX ( 'Table'[A] ) ) ) VAR b = COUNTROWS ( FILTER ( ALL ( 'Table' ), 'Table'[A] = MAX ( 'Table'[A] ) && 'Table'[B] = MAX ( 'Table'[B] ) ) ) RETURN IF ( a = b, "black" ,"red")If the problem is still not resolved, please provide detailed error information and let me know immediately. Looking forward to your reply.
Best Regards,
Henry
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.