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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
Rsanjuan
Helper IV
Helper IV

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
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.