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
Danzlo
Frequent Visitor

Is it possible to group existing columns into a table or perhaps a new calculated column?

Hi!

I have three different tables with a column named "Job Type". Two of the columns are already grouped with data from the table into a "grouped column".

I would like to either create a new table with the three columns combined or just a new calculated column with these values.

Is it possbile? Will illustrate my need below:

Danzlo_0-1634635662082.png

Kind Regards
Daniel




2 ACCEPTED SOLUTIONS
TheoC
Super User
Super User

Hi @Danzlo 

 

Certainly is possible. Here are a few links:

 

https://stackoverflow.com/questions/66681505/dax-power-bi-summarize-table-based-on-two-columns

https://www.sqlbi.com/articles/all-the-secrets-of-summarize/

 

The SQLBI is pretty great in terms of it's level of detail.   Ultimately, many ways that it can be done. Using DAX, you can use SUMMARIZE, among other functions. Alternatively, you can use Power Query to append / merge (https://radacad.com/append-vs-merge-in-power-bi-and-power-query) queries / tables.

 

Hope this helps 🙂

If I have posted a response that resolves your question, please accept it as a solution to formally close the post.

Also, if you are as passionate about Power BI, DAX and data as I am, please feel free to reach out if you have any questions, queries, or if you simply want to connect and talk to another data geek!

Want to connect?www.linkedin.com/in/theoconias

View solution in original post

Danzlo
Frequent Visitor

Hi @TheoC 
Great explanations and info. Much obliged! However, the append method combines all tables and data into one which was not what i was after. I wanted to withdraw a single column from each table and combine them either into a new table or a calculated column.
I fixed this by creating a new table harcoded the data and created a one to many relationship to the other tables.

View solution in original post

6 REPLIES 6
TheoC
Super User
Super User

Hi @Danzlo 

 

Mate, just a quick one, I wanted to show you the output of Append as New in Power Query with direct reference to your scenario (apologies I didn't put this together sooner - I only realised you had provided a breakdown of your tables in your initial post after I looked at it on my computer rather than the phone).

 

I created two dummy tables in Table1 and Table 2 like below.  The below is in Power Query and I have combined two screenshots to show you that the two tables are unique. Note that there is no relationship between these and when you use Merge or Append, there is absolutely no need.  

TheoC_0-1634675677818.png

In Power Query, under the Home tab in the main ribbon, go to the Combine section and click the down arrow on to the right of "Append Queries".  You will see "Append Queries as New" - click this.

TheoC_1-1634675814991.png

A pop up window will appear.  If you have two tables or less that you want to append, obviously select "two tables" otherwise, for three or more, you can click on "Three or more tables". Add your two tables; in this scenario, it is Table1 and Table2:

TheoC_2-1634675906964.png

The output is a new query / table called Append1.  It pretty much gives you the output you were after 🙂

TheoC_3-1634675971066.png

Just as a side note, Append is brilliant for scenarios where the same columns / structure exists (i.e. column titles, data types, number of columns, etc).  If you have a situation where you are not so much concerned as to the rows, but one table might have more columns, etc., than the other, you can use Merge Queries for this.

 

Hope this helps and again, sincere apologies for the delay in providing this.

 

The same can be done using DAX, however, given the simplicity and cleanliness of using Power Query to achieve this, you are far less likely to run into errors / problems down the track with you Data Model when using Power Query to manage this process.

 

All the best mate! 🙂

 

Theo

If I have posted a response that resolves your question, please accept it as a solution to formally close the post.

Also, if you are as passionate about Power BI, DAX and data as I am, please feel free to reach out if you have any questions, queries, or if you simply want to connect and talk to another data geek!

Want to connect?www.linkedin.com/in/theoconias

Danzlo
Frequent Visitor

Hi @TheoC 
Great explanations and info. Much obliged! However, the append method combines all tables and data into one which was not what i was after. I wanted to withdraw a single column from each table and combine them either into a new table or a calculated column.
I fixed this by creating a new table harcoded the data and created a one to many relationship to the other tables.

@Danzlo Nice work! Am glad you managed to resolve, and in a nice fashion!

If I have posted a response that resolves your question, please accept it as a solution to formally close the post.

Also, if you are as passionate about Power BI, DAX and data as I am, please feel free to reach out if you have any questions, queries, or if you simply want to connect and talk to another data geek!

Want to connect?www.linkedin.com/in/theoconias

TheoC
Super User
Super User

Hi @Danzlo 

 

Certainly is possible. Here are a few links:

 

https://stackoverflow.com/questions/66681505/dax-power-bi-summarize-table-based-on-two-columns

https://www.sqlbi.com/articles/all-the-secrets-of-summarize/

 

The SQLBI is pretty great in terms of it's level of detail.   Ultimately, many ways that it can be done. Using DAX, you can use SUMMARIZE, among other functions. Alternatively, you can use Power Query to append / merge (https://radacad.com/append-vs-merge-in-power-bi-and-power-query) queries / tables.

 

Hope this helps 🙂

If I have posted a response that resolves your question, please accept it as a solution to formally close the post.

Also, if you are as passionate about Power BI, DAX and data as I am, please feel free to reach out if you have any questions, queries, or if you simply want to connect and talk to another data geek!

Want to connect?www.linkedin.com/in/theoconias

Danzlo
Frequent Visitor

Hi @TheoC and thank you for your reply.

I dont want to merge them together into one row. I want to create a distinct list of each value within all three job type columns.

Dont think that summarize will work since the columns contain strings only.

Do you have another example. I can provide you with the columns so that you can see for yourself perhaps?

Hi @Danzlo,

 

In Power Query, there is "Group By" and "Unpivot". If you send me an example of the data in current form and how you want it structured, I can prepare a PBIX for you and share it with you?

 

Thanks heaps,

Theo

If I have posted a response that resolves your question, please accept it as a solution to formally close the post.

Also, if you are as passionate about Power BI, DAX and data as I am, please feel free to reach out if you have any questions, queries, or if you simply want to connect and talk to another data geek!

Want to connect?www.linkedin.com/in/theoconias

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.