Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

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:

PowerBI_Input.png

 

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

PowerBI_Output.png

1 ACCEPTED SOLUTION
V-pazhen-msft
Community Support
Community Support

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”:

1.jpg

This is the DAX formula:

 

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

 

This is the Return:

2.png

 

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.

View solution in original post

6 REPLIES 6
V-pazhen-msft
Community Support
Community Support

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”:

1.jpg

This is the DAX formula:

 

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

 

This is the Return:

2.png

 

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
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:
1 - Data View.png

 

Then I go back to the Report view and hit the New measure button.
2 - new measure.png

 

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.
3 - Dax formula.png

 

I then click on Matrix
4 - new matrix.png

 

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

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

6 - error.png

HI, @Anonymous 

 

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

3.PNG

Anonymous
Not applicable

Thanks! This works.

amitchandak
Super User
Super User

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

parry2k
Super User
Super User

@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.



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.