Forum Discussion
Concatenate Text Measure based on multiple columns
Hi,
I have a dataset like this:
| ID | COL1 | COL2 |
| 1 | A2 | A |
| 2 | B | B |
| 3 | B1 | B |
| 4 | A3 | A |
| 5 | C | C |
and I want to create a measure to be used in a tooltip to display the list of COL1 in a graph based on COL2, so fo example when COL2 = "A" the result should be "A2, A3".
I created this measure but it is showing just the first value:
- Anonymous2 years ago
Hi arimoldi ,
I made simple samples and you can check the results below:
Measure = var _t = CALCULATETABLE('Table',FILTER('Table',[COL1]<>[COL2])) RETURN CONCATENATEX(_t,[COL1],",")An attachment for your reference. Hope it helps!
Best regards,
Community Support Team_ Scott ChangIf this post helps then please consider Accept it as the solution to help the other members find it more quickly.
5 Replies
- Daniel29195Community Champion
measure =
concatenatex ( values( tab[col1] ) , tab[col1] , " ,")
let me know if this helps .
If my answer helped sort things out for you, i would appreciate a thumbs up 👍 and mark it as the solution ✅
It makes a difference and might help someone else too. Thanks for spreading the good vibes! 🤠:- arimoldiResolver II
Hi,
thanks for reply.
With your formula I still get one value when I select the aggregated column (eg in my example when I select "A" from COL2 I get just "A2" as output).
Any other suggestiona?
Thanks,
Andrea
- Daniel29195Community Champion
if you are using both columns in the visual then modify the code to this :
Measure2 =var s = CALCULATETABLE( VALUES(tbl2[COL1]) , ALL(tbl2[COL1]))RETURNCONCATENATEX(s, tbl2[COL1], " , " )output if using only col2 :
output if using both :
let me k ow if this works .
If my answer helped sort things out for you, i would appreciate a thumbs up 👍 and mark it as the solution ✅
It makes a difference and might help someone else too. Thanks for spreading the good vibes! 🤠:- arimoldiResolver II
Hi,
I found out that on the whole dataset for some aggregated values it is working correctly but for others it is not.
If in COL1 there is one value equal to COL2 could it be discarded in the visualization?
I mean something like this:
ID COL1 COL2 1 A2 A 4 A A Thanks,
Andrea
- AnonymousNot applicable
Hi arimoldi ,
I made simple samples and you can check the results below:
Measure = var _t = CALCULATETABLE('Table',FILTER('Table',[COL1]<>[COL2])) RETURN CONCATENATEX(_t,[COL1],",")An attachment for your reference. Hope it helps!
Best regards,
Community Support Team_ Scott ChangIf this post helps then please consider Accept it as the solution to help the other members find it more quickly.