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

Vote for your favorite vizzies from the Power BI Dataviz World Championship submissions. Vote now!

Reply
andash
New Member

SUM Values if quarter equal to

Hi I am using power query to manipulate some data. I have a "Quarter" column and a "Total Amount" column. I want to get the sum of the "Total Amount" column if the "Quarter" column is equal to a criterion. For example, if the value in "Quarter" is Q1-2017, and there are 15 values in the "Total Amount" column matched to Q1-2017, I want to sum only those values in Total Amount.

 

Right now I am using the following formula in power query:

 

if [Quarter] = "Q2-2017" then List.sum(#"Changed Type"[Total Amount]) else null

 

This formula, however, is giving the total sum of all quarters regardless of the conditional pointing to only Q2-2017. Please advise! Thank you!

1 ACCEPTED SOLUTION
MFelix
Super User
Super User

Hi @andash,

In the query editor you need to select the option groupby, the. Select the quarter column and on the aggregate part select the column you want and sum.

This will give you the aggregation per each quarter.

Be aware that this step will make a table with only 2 columns quarte and the sum of the value you need.

Regards,

Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português





View solution in original post

3 REPLIES 3
MFelix
Super User
Super User

Hi @andash,

In the query editor you need to select the option groupby, the. Select the quarter column and on the aggregate part select the column you want and sum.

This will give you the aggregation per each quarter.

Be aware that this step will make a table with only 2 columns quarte and the sum of the value you need.

Regards,

Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português





Thank you! This is exactly what I needed.

az38
Community Champion
Community Champion

Hi @andash 

it doesnt look like a good idea to calculate this in power query.

i could advice you to use an easy DAX-statement measure

Measure = 
CALCULATE(
SUM('Table'[Total Amount]);
FILTER(ALL('Table');'Table'[Quarter] = "Q2-2017")
)

do not hesitate to give a kudo to useful posts and mark solutions as solution


do not hesitate to give a kudo to useful posts and mark solutions as solution
LinkedIn

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

Vote for your favorite vizzies from the Power BI World Championship submissions!

Sticker Challenge 2026 Carousel

Join our Community Sticker Challenge 2026

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

January Power BI Update Carousel

Power BI Monthly Update - January 2026

Check out the January 2026 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.