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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
darinme
Microsoft Employee
Microsoft Employee

creating a new table that sums values from rows of another table that have the same dateid

*updated for clarity*

Hi,

 

I want to create a table that sums values from rows of a different table where the sum is for the desired values from the same date.

 

Best way I can explain:

From: 

DateIdSettingNameTotalCount
20210901Value150
20210901Value220
20210901Value3111
20210902Value140
20210902Value210
20210901Value3222

Create a new table like this (where I only bring over the sum for Value 1 and Value 2):

DateIdSettingNameTotalCount
20210901Value1Value270
20210902Value1Value250

 

Note: SettingName value can be static text but can also go with concatenated.

1 ACCEPTED SOLUTION

Hi @darinme 

 

Try this to exclude Value3 from the new table:

 

Table 2 = 
SUMMARIZE (
    filter('Table','Table'[SettingName]<>"Value3"),
    'Table'[DateId],
    "SettingName", CONCATENATEX ( 'Table', 'Table'[SettingName], "" ),
    "TotalCount", SUM ( 'Table'[TotalCount] )
)

 

DATA :

VahidDM_0-1638237514206.png

 

Output:

 

VahidDM_1-1638237534035.png

 

If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!
LinkedIn: 
www.linkedin.com/in/vahid-dm/

 

 

View solution in original post

6 REPLIES 6
VahidDM
Super User
Super User

HI @darinme 

 

If you want a DAX code to create a new table, try this:

 
 

https://docs.microsoft.com/en-us/power-bi/transform-model/desktop-calculated-tables

 

 

Table 2 = 
SUMMARIZE (
    'Table',
    'Table'[DateId],
    "SettingName", CONCATENATEX ( 'Table', 'Table'[SettingName], "" ),
    "TotalCount", SUM ( 'Table'[TotalCount] )
)

 

 

Output:

 

VahidDM_3-1638235321822.png

 

 

 

If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!
LinkedIn: 
www.linkedin.com/in/vahid-dm/

 

darinme
Microsoft Employee
Microsoft Employee

Thanks for that and would be perfect to my posted question.  I realize that I negelcted to state there are other SettingNames values I do not want to include.  
Updating my table example where I do not want to bring over Value3 into the new table.

DateIdSettingNameTotalCount
20210901Value150
20210901Value220
20210901Value3111
20210902Value140
20210902Value210
20210901Value3222

Create a new table like this:

DateIdSettingNameTotalCount
20210901Value1Value270
20210902Value1Value250
Vera_33
Resident Rockstar
Resident Rockstar

Hi @darinme 

 

When you said a new table, it is a table you go with Power Query or DAX Calculated table, or a table visual?

 

You can groupby in M

Vera_33_0-1638232989705.png

Table.Group(#"Changed Type", {"DateId"}, {{"newSettingName", each Text.Combine(_[SettingName],";")}, {"newTotalCount", each List.Sum([TotalCount]), type nullable number}})

Or go with measures for a table visual

Vera_33_1-1638233022469.png

newName = CONCATENATEX('Table','Table'[SettingName],";")

newTotalCount = SUM('Table'[TotalCount])

 

 

darinme
Microsoft Employee
Microsoft Employee

Thank you.  I prefer DAX table.  I also neglected to state there are other SettingNames values I do not want to include.  
Updating my table example where I do not want to bring over Value3 into the new table.

DateIdSettingNameTotalCount
20210901Value150
20210901Value220
20210901Value3111
20210902Value140
20210902Value210
20210901Value3222

Create a new table like this:

DateIdSettingNameTotalCount
20210901Value1Value270
20210902Value1Value250

Hi @darinme 

 

Try this to exclude Value3 from the new table:

 

Table 2 = 
SUMMARIZE (
    filter('Table','Table'[SettingName]<>"Value3"),
    'Table'[DateId],
    "SettingName", CONCATENATEX ( 'Table', 'Table'[SettingName], "" ),
    "TotalCount", SUM ( 'Table'[TotalCount] )
)

 

DATA :

VahidDM_0-1638237514206.png

 

Output:

 

VahidDM_1-1638237534035.png

 

If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!
LinkedIn: 
www.linkedin.com/in/vahid-dm/

 

 

darinme
Microsoft Employee
Microsoft Employee

That does it!  Thanks.  I also discovered that I can do the inverse using 'IN' to only select the fields I want.  Useful when there are many values and only wnat a few.

 

Table 2 = 
SUMMARIZE (
    filter('Table','Table'[SettingName] IN {"Value1","Value2")},
    'Table'[DateId],
    "SettingName", CONCATENATEX ( 'Table', 'Table'[SettingName], "" ),
    "TotalCount", SUM ( 'Table'[TotalCount] )

 

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.