Forum Discussion

Cynot's avatar
Cynot
Advocate I
10 years ago
Solved

Text in a Matrix

Hello all,

 

I am trying to create a dashboard that displays some information in a matrix, but the problem I am having is that the value field I want to display is actually a string.  It is a code that is assoicated with various columns in the matrix, but it appears that powerBI only wants to let me place numerical values in a matrix.

 

If I try to enter a text field, it just tries to summarize by using "count of" fieldname.  Is there a way I can use text values in a matrix? Or perhaps another visual that will let me accomplish the equvilant?

 

 

 

 

  • Yes you can do this, but only when the string returns a single value. Write a measure something like this

     

    =if(hasonevalue(table[column]),values(table[column]))

     

    there is a new function called concatenatex that allows you to build a string of values on the fly in the instance that there is more than a single value returned. Just google the syntax. 

     

    =if(hasonevalue(table[column]),values(table[column]),concatenatex(table,table[column],", "))

13 Replies

  • MattAllington's avatar
    MattAllington
    Community Champion

    Yes you can do this, but only when the string returns a single value. Write a measure something like this

     

    =if(hasonevalue(table[column]),values(table[column]))

     

    there is a new function called concatenatex that allows you to build a string of values on the fly in the instance that there is more than a single value returned. Just google the syntax. 

     

    =if(hasonevalue(table[column]),values(table[column]),concatenatex(table,table[column],", "))

    • Cynot's avatar
      Cynot
      Advocate I

      Sorry for the delayed response, I got pulled away on other projects and just got to test this out today.  Thank you!

       

      That worked like a charm.  My only other question would be (and I think the answer is no but I'm being picky), is there any way I can add columns after the pivoted column in a matrix?

       

      In other words if my "columns" value that is being pivoted is product code, and I want the matrix to look comething like:

       

      Order | Customer | Product Codes ... | ... | ...| Due Date | Etc |

       

      Is that possible?

       

      Thanks again!

      • MattAllington's avatar
        MattAllington
        Community Champion

        This can be done easily in Excel with Fields, Items and Sets, but I don't believe it can be done today in Power BI.  There are some table updates coming shortly (improved visuals) so let's see if there is any change then.

    • AntJB's avatar
      AntJB
      New Member

      How do we add a new line character as a delimter so each component text value is on a new line.  It seems like even if the data source itself has new lines / carriage returns the matrix & table visualisations (in fact any visualisation) ignores new lines and puts everything on a single line

       

      Thanks

      Anthony

    • AntJB's avatar
      AntJB
      New Member

      How do we add a new line character as a delimter so each component text value is on a new line.  It seems like even if the data source itself has new lines / carriage returns the matrix & table visualisations (in fact any visualisation) ignores new lines and puts everything on a single line

       

      Thanks

      Anthony