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
abukapsoun
Post Patron
Post Patron

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
TomMartens
Super User
Super User

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



Did I answer your question? Mark my post as a solution, this will help others!

Proud to be a Super User!
I accept Kudos 😉
Hamburg, Germany

View solution in original post

2 REPLIES 2
v-huizhn-msft
Employee
Employee

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

TomMartens
Super User
Super User

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



Did I answer your question? Mark my post as a solution, this will help others!

Proud to be a Super User!
I accept Kudos 😉
Hamburg, Germany

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.