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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
Rsanjuan
Advocate III
Advocate III

Add a column to sum sales if a specific criteria is met

There are two colums:

 

Sales and Job Phase

 

Job Phase has the following statuses:  Confirmed, In Process, and In Field.

 

I need to create a column where it adds up the sales only when Job Phase = confirmed or in process.  

 

Can someone please help me what would be the correct syntax to add in the query editor?  Thank you!

 

 

2 ACCEPTED SOLUTIONS

I changed it to this:  

 

ConfirmedInProcess Total = CALCULATE(Sum('SF Project Report'[Sales.amount]),'SF Project Report'[Job Phase]=Confirmed||'SF Project Report'[Job Phase]=In Process)

 

And it says Syntax for "In" is incorrect

 

 

View solution in original post

jahida
Impactful Individual
Impactful Individual

You lost the quotes now on the strings (Confirmed -> "Confirmed", In Process -> "In Process")

View solution in original post

6 REPLIES 6
asocorro
Skilled Sharer
Skilled Sharer

You have several ways of doing this.  First, I got this raw data:

 

raw data.png

 

Then I can get grouping and sum like this:

 

table with sum.png

 

Than I can filter like this:

 

 

 

ft.png

 

And I can also have a measure like this:

 

Sales For Phases 1 and 2 = CALCULATE(SUM(SalesHistory[Sales]), SalesHistory[Phase] = 1 || SalesHistory[Phase] = 2)

 

measure.png

 

 

Connect with me in LinkedIn: https://pr.linkedin.com/in/adolfosocorro
Follow me on Twitter: https://twitter.com/AdolfoSocorro

Thank you for your help.  I tried to set it up like this:

 

ConfirmedInProcess Total = CALCULATE(Sum('SF Project Report'[Sales.amount]),'SF Project Report'[Job Phase]='Confirmed'||'SF Project Report'[Job Phase]='In Process'))

 

but I'm getting a syntax error.  Any ideas?

jahida
Impactful Individual
Impactful Individual

Extra right bracket at the end?

I changed it to this:  

 

ConfirmedInProcess Total = CALCULATE(Sum('SF Project Report'[Sales.amount]),'SF Project Report'[Job Phase]=Confirmed||'SF Project Report'[Job Phase]=In Process)

 

And it says Syntax for "In" is incorrect

 

 

jahida
Impactful Individual
Impactful Individual

You lost the quotes now on the strings (Confirmed -> "Confirmed", In Process -> "In Process")

Got it working.  Thanks!

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.

Top Solution Authors