Forum Discussion

arimoldi's avatar
arimoldi
Resolver II
2 years ago
Solved

Concatenate Text Measure based on multiple columns

Hi,

 

I have a dataset like this:

IDCOL1COL2
1A2A
2BB
3B1B
4A3A
5CC

 

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:

CONCATENATEX(SUMMARIZE(tab, tab[COL2], tab[COL1]), tab[COL1]", ")
 
Any suggestion?
 
Thanks,
Andrea
 
  • Anonymous's avatar
    Anonymous
    2 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 Chang

     

    If this post helps then please consider Accept it as the solution to help the other members find it more quickly.

5 Replies

  • Daniel29195's avatar
    Daniel29195
    Community Champion

    arimoldi 

     

    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! 🤠:

    • arimoldi's avatar
      arimoldi
      Resolver 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

  • Daniel29195's avatar
    Daniel29195
    Community Champion

    arimoldi 

    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]))

     

    RETURN
    CONCATENATEX(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! 🤠:

     
    • arimoldi's avatar
      arimoldi
      Resolver 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:

       

      IDCOL1COL2
      1A2A
      4AA

       

      Thanks,

      Andrea

  • Anonymous's avatar
    Anonymous
    Not 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 Chang

     

    If this post helps then please consider Accept it as the solution to help the other members find it more quickly.