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
OscarSuarez10
Helper III
Helper III

Total production pero year and product in one table

Hello How can I use power query to sum the total production per year AND product including the production of each prouduct in only one table , as in the right table ?

 

YEAR PRODUCT 1PRODUCT 2PRODUCT 3 TOTALTOTAL PRODUCTION 1TOTAL PRODUCTION 2TOTAL PRODUCTION 3
2019A50798100 2019208829233
2020A605047 2020176271292
2021A70089 202112527118
2019B8010123     
2020B100123156     
2021B451514     
2019C782110     
2020C169889     
2021C101215     
2 ACCEPTED SOLUTIONS
Anonymous
Not applicable

Power Query and DAX are set up to work best with data in tabular format.  After you load your table, select Year and then Unpivot Other Columns.  Then from there you can GROUPBy Year and Attribute, with a new Column for SUM.  This will still have the table in tabular format, but then you can use a matrix, table, pivot table to get the output how you want to see it

Unpivot and Groupby.png

View solution in original post

edhans
Super User
Super User

Because you already have the columns like you want, just use GroupBy in the Transform ribbon of Power Query, select Advanced, then set it up like this:

 

20190815 10_47_48-.png

strictly speaking that will give you want you want, but @Anonymous is right, you are better off going through the extra steps to have your data in a normalized table.



Did I answer your question? Mark my post as a solution!
Did my answers help arrive at a solution? Give it a kudos by clicking the Thumbs Up!

DAX is for Analysis. Power Query is for Data Modeling


Proud to be a Super User!

MCSA: BI Reporting

View solution in original post

2 REPLIES 2
edhans
Super User
Super User

Because you already have the columns like you want, just use GroupBy in the Transform ribbon of Power Query, select Advanced, then set it up like this:

 

20190815 10_47_48-.png

strictly speaking that will give you want you want, but @Anonymous is right, you are better off going through the extra steps to have your data in a normalized table.



Did I answer your question? Mark my post as a solution!
Did my answers help arrive at a solution? Give it a kudos by clicking the Thumbs Up!

DAX is for Analysis. Power Query is for Data Modeling


Proud to be a Super User!

MCSA: BI Reporting
Anonymous
Not applicable

Power Query and DAX are set up to work best with data in tabular format.  After you load your table, select Year and then Unpivot Other Columns.  Then from there you can GROUPBy Year and Attribute, with a new Column for SUM.  This will still have the table in tabular format, but then you can use a matrix, table, pivot table to get the output how you want to see it

Unpivot and Groupby.png

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.

Top Solution Authors
Top Kudoed Authors