cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Enkei
Frequent Visitor

Power Query to create a new table and column that is sum of two columns from another table.

Hello,

 

I have a table, I want to create another table which is a result of sum of two columns from another table.

1 ACCEPTED SOLUTION

@Enkei 

Create a bank query and the paste following code and modify it as [per your table and column names. I attached a small file after my signature.

let
    Source = List.Sum(#"1"[Female]) / List.Sum(#"1"[Male]),
    #"Converted to Table" = #table(1, {{Source}})
in
    #"Converted to Table"



Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

View solution in original post

3 REPLIES 3
Fowmy
Super User
Super User

@Enkei 

Not clear about the requirement. 
You can Right-Click the query and select "Reference", then group the columns.

 

Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

Enkei
Frequent Visitor

Hello @Fowmy 
I am attaching images below. I want the sum of female divided by sum of men in new table

 

titanic.PNG

 

@Enkei 

Create a bank query and the paste following code and modify it as [per your table and column names. I attached a small file after my signature.

let
    Source = List.Sum(#"1"[Female]) / List.Sum(#"1"[Male]),
    #"Converted to Table" = #table(1, {{Source}})
in
    #"Converted to Table"



Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

View solution in original post

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

November Power BI Update 768x460.png

Check it Out!

Click here to read more about the November 2021 Updates!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.

Top Solution Authors
Top Kudoed Authors