cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
abukapsoun Helper III
Helper III

Summing values in a row

Hi,

 

Need your help again and again please,

 

I have the following case:

P1   P2   P3   P4  

1      4     3    4

2      6     3    1 

3      7     1    1 

 

How can I create a new table to have the following

P1           P2             P3             P4 

Sum(P1) Sum (P2) Sum (P3)  Sum (P4)

 

Thanks,

Moh

 

1 ACCEPTED SOLUTION

Accepted Solutions
Super User III
Super User III

Re: Summing values in a row

Hey,

 

as always there is more than 1 way to achieve what you want, for this reason I created a little Power BI file

 

This file contains 3 tables

Table1 - sample data, created using the function "Enter Data"

UsingPowerQuery - a table created by using the Function "Group By" from the Ribbon "Transform"

UsingDAX - This table is created by the following DAX statement

UsingDAX = 
SUMMARIZE('Table1', "P1sum", SUM('Table1'[P1]),"P2sum", SUM('Table1'[P2]), "P3sum", SUM('Table1'[P3]),"P4sum", SUM('Table1'[P4]))

Without knowing the exact use case for this requirement, my recommendation will be to go with the PowerQuery exmple.

 

From my point of view, tables created using Power Query can be used as persistet tables in the Data Model of Power BI, whereas tables created using DAX statements are in a way static, so the content of these tables are not controlled by the selection of slicers.

 

Hope this gets you started

 

Regards

Hamburg - Germany
If I answer your question, please mark my post as solution, this will also help others.
I accept Kudos :-), If you find my post helpful.

Proud to be a Datanaut!

View solution in original post

2 REPLIES 2
Super User III
Super User III

Re: Summing values in a row

Hey,

 

as always there is more than 1 way to achieve what you want, for this reason I created a little Power BI file

 

This file contains 3 tables

Table1 - sample data, created using the function "Enter Data"

UsingPowerQuery - a table created by using the Function "Group By" from the Ribbon "Transform"

UsingDAX - This table is created by the following DAX statement

UsingDAX = 
SUMMARIZE('Table1', "P1sum", SUM('Table1'[P1]),"P2sum", SUM('Table1'[P2]), "P3sum", SUM('Table1'[P3]),"P4sum", SUM('Table1'[P4]))

Without knowing the exact use case for this requirement, my recommendation will be to go with the PowerQuery exmple.

 

From my point of view, tables created using Power Query can be used as persistet tables in the Data Model of Power BI, whereas tables created using DAX statements are in a way static, so the content of these tables are not controlled by the selection of slicers.

 

Hope this gets you started

 

Regards

Hamburg - Germany
If I answer your question, please mark my post as solution, this will also help others.
I accept Kudos :-), If you find my post helpful.

Proud to be a Datanaut!

View solution in original post

Highlighted
Microsoft
Microsoft

Re: Summing values in a row

Hi @abukapsoun,

As I tested, the solution @TomMartens posted is right. If you have resolved your issue, please mark the right reply as answer.

Thanks,
Angelia

Helpful resources

Announcements
Announcing the New Spanish Forum

Announcing the New Spanish Forum

Do you need help in Spanish? Check out our new Spanish community section.

April 2020 Community Highlights

April 2020 Community Highlights

Info on our Super Users, MBAS content and badges, and updates to our support articles. - Read the full Community Highlights.

MBAS Gallery 2020

MBAS Gallery 2020

Watch Microsoft Business Applications Summit sessions on-demand.

Top Solution Authors
Top Kudoed Authors