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
KaterineCAA
Frequent Visitor

Calculate sum of column in query editor

I have the following table in the query editor of PowerBI.

I would like to either :

- Calculate the sum of "Nombre de répondants" and add it in a new column (it would be the same value for every line) or

- Calculate the proportion of "Nombre de répondants"

 

As a result, I would have one of the two new columns in the second image. (My 249 will varie in the future)

I would prefer doing it in the query editor.

 

Thank you!

 

Actual Table :

 

Actual table - v2.png

 

Wanted table :

 

wanted table - v2.png

 

 

1 ACCEPTED SOLUTION
v-xjiin-msft
Solution Sage
Solution Sage

@KaterineCAA

 

To achieve your requirement, you can refer to following steps:

 

  1. In Edit Queries, go to Add Column and add a Custom Column.
  2. Use Power Query expression like: List.Sum(#"Changed Type"[Nombre de répondants]) to get the sum of Nombre de répondants.
  3. Then for Proportion, you can simply use expression like: [Nombre de répondants]/[ Nombre de répondants Total]

 

Thanks,
Xi Jin.

View solution in original post

3 REPLIES 3
v-xjiin-msft
Solution Sage
Solution Sage

@KaterineCAA

 

To achieve your requirement, you can refer to following steps:

 

  1. In Edit Queries, go to Add Column and add a Custom Column.
  2. Use Power Query expression like: List.Sum(#"Changed Type"[Nombre de répondants]) to get the sum of Nombre de répondants.
  3. Then for Proportion, you can simply use expression like: [Nombre de répondants]/[ Nombre de répondants Total]

 

Thanks,
Xi Jin.

Hi, is this solution still current, i cannot get it to work

Thank you so much!

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.