Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago
Solved

Create a custom column

Hello, I'm a new Power BI user and need some assistance in merging columns.


This is the excel data input:

 

I want to create a matrix in Power BI that takes the names from both columns A and B, like this:

  • Anonymous's avatar
    Anonymous
    6 years ago

    Hi Anonymous ,

     

    Based on your description, I suggest you to use DAX Union function to create a calculated table. See Below:

    This is the imported Excel Table named “Sheet1”:

    This is the DAX formula:

     

    Table =
    UNION (
        SUMMARIZE ( Sheet1, Sheet1[Column 1] ),
        SUMMARIZE ( Sheet1, Sheet1[Column 2] )
    )

     

    This is the Return:

     

    Best Regards,

    Paul Zheng

     

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

6 Replies

  • Anonymous you can add new column in your table and concatenate your columns

     

    Name A and B = 
    Table[Column A] & " " & Table[Column B]

     

    Hope this is what you are looking for.

  • Try union and Summarize

     

    Sheet = union(SUMMARIZE(Sales,Sales[Brand]),SUMMARIZE(Sales,Sales[Brand1]))

     

    The information you have provided is not making the problem clear to me. Can you please explain with an example. If possible please share a sample pbix file after removing sensitive information.
    Thanks

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi Anonymous ,

     

    Based on your description, I suggest you to use DAX Union function to create a calculated table. See Below:

    This is the imported Excel Table named “Sheet1”:

    This is the DAX formula:

     

    Table =
    UNION (
        SUMMARIZE ( Sheet1, Sheet1[Column 1] ),
        SUMMARIZE ( Sheet1, Sheet1[Column 2] )
    )

     

    This is the Return:

     

    Best Regards,

    Paul Zheng

     

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

    • Anonymous's avatar
      Anonymous
      Not applicable

      Hello, thanks for your help, this is the results i'm looking for. However is still can't get it to work.

      I've created a table that exactly matches your example. I will try to explain it step by step.

      This is how it looks in the Data view:

       

      Then I go back to the Report view and hit the New measure button.

       

      I type in the formula you send me. At first I was getting a syntax error but I think that was due to a regional setting, it seems like I need to use semi-colon instead of comma.

       

      I then click on Matrix

       

      I then try to drag and drop the measure I created. However it wont let drop in it either Rows or Columns.

      If I drop in the Values field, I get the following error:

      • Anonymous's avatar
        Anonymous
        Not applicable

        HI, Anonymous 

         

        The formula that I provided is only available for creating Calculate Tables.