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
stfnzmmrmnn
New Member

Combining rows based on two or more columns

Hi all, I am looking for a (easy) way to combine rows by some key vallues.

 

It's best explained by an example:

 

idtimezonetemperaturelongitudelatitude
1Berlin23nullnull
1Berlin070000008000000
2Berlin30nullnull
2Berlin060000005000000
2New York0nullnull
3Spain33nullnull
3Spain040000005500000

 

I am looking for a way to combine the rows by more than one key value (in this example only if id AND timezone is equal).

 

The result would be like this:

 

idtimezonetemperaturelongitudelatitude
1Berlin2370000008000000
2Berlin3060000005000000
2New York0nullnull
3Spain3340000005500000

 

 

I appreciate any help I can get!

 

Thank you very much!

 

Cheers

Stef

 

2 ACCEPTED SOLUTIONS
Zubair_Muhammad
Community Champion
Community Champion

Hi @stfnzmmrmnn

 

Try creating a Calculated Table from Modelling Tab>>>New Table

 

New Table =
SUMMARIZE (
    Table1,
    Table1[id],
    Table1[timezone],
    "temperature", SUM ( Table1[temperature] ),
    "Longitude", SUM ( Table1[longitude] ),
    "Latitude", SUM ( Table1[latitude] )
)

 

 


Regards
Zubair

Please try my custom visuals

View solution in original post

Ashish_Mathur
Super User
Super User

Hi,

 

You can do this in the Query Editor.  Select the first two headings and right click > Group.  Select the SUM function there for the remaining three columns.

 

Hope this helps.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

View solution in original post

2 REPLIES 2
Ashish_Mathur
Super User
Super User

Hi,

 

You can do this in the Query Editor.  Select the first two headings and right click > Group.  Select the SUM function there for the remaining three columns.

 

Hope this helps.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
Zubair_Muhammad
Community Champion
Community Champion

Hi @stfnzmmrmnn

 

Try creating a Calculated Table from Modelling Tab>>>New Table

 

New Table =
SUMMARIZE (
    Table1,
    Table1[id],
    Table1[timezone],
    "temperature", SUM ( Table1[temperature] ),
    "Longitude", SUM ( Table1[longitude] ),
    "Latitude", SUM ( Table1[latitude] )
)

 

 


Regards
Zubair

Please try my custom visuals

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.