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
harrinho
Helper III
Helper III

Calculate SUM with Multiple Criteria

Hi Community, 

 

I want to create a measure which will calculate the price of my line items (opportunities) when: 

Family_type = "Product" AND business_type_name="New" and Closed Pipeline="Open"

 

I tried the following but it never worked.  

 

4Q TCV = CALCULATE(SUM('FACT_PIPELINE'[SalesPrice],IF(AND('FACT_PIPELINE'[Family]= "Product",'FACT_PIPELINE'[business_type_name]= "New",'FACT_PIPELINE'[Closed Pipeline]="Open")

Is there any way to achieve this?

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi

Try this.

4Q TCV = 
CALCULATE(SUM(FACT_PIPELINE[SalesPrice]),
                     FILTER (FACT_PIPELINE, FACT_PIPELINE[Family]= "Product"),
                     FILTER (FACT_PIPELINE,FACT_PIPELINE[business_type_name]= "New"),
                     FILTER (FACT_PIPELINE,'FACT_PIPELINE'[Closed Pipeline]="Open")
         )

Thanks

 

Raj

View solution in original post

5 REPLIES 5
Anonymous
Not applicable

Hi

Try this.

4Q TCV = 
CALCULATE(SUM(FACT_PIPELINE[SalesPrice]),
                     FILTER (FACT_PIPELINE, FACT_PIPELINE[Family]= "Product"),
                     FILTER (FACT_PIPELINE,FACT_PIPELINE[business_type_name]= "New"),
                     FILTER (FACT_PIPELINE,'FACT_PIPELINE'[Closed Pipeline]="Open")
         )

Thanks

 

Raj

Anonymous
Not applicable

I have been trying to utilize this same concept to sum all rows that meet multiple VAR critera, but its not quite working. What I am trying to do is a calculation of the last 4 weeks of sales. If I use only one variable I am able to bring data for only one week, but if i add another filter criteria to take into consideration an additional week it shows blank. 

 

Any ideas?

 

 

ivargaspr_0-1601330514519.png

 

@Anonymous hey hey!  stumbled across this old thread and am using your recommendation below.  It's been very helpful to me already -- thanks!!!

 

One other question -- can you show me how to make one of the filters an AND statement?  

 

I've tried using && but can tell it wasn't quite the right placement.  Basically just looking for some of my rows to have 2 criteria that are mandatory in order to be included in the SUM.

Thanks Raj!  Answered a question of mine, too - your contribution is appreciated.

drewlewis15
Solution Specialist
Solution Specialist

When using the CALCULATE function, you do not need to add the IF and AND functions.   The CALCULATE function has filter syntax built in.  CALCULATE(<measure expression>, <filter1>, <filter2>, ...)

 

So your statement should read:

 

4Q TCV = CALCULATE(SUM('FACT_PIPELINE'[SalesPrice]),'FACT_PIPELINE'[Family]= "Product",'FACT_PIPELINE'[business_type_name]= "New",'FACT_PIPELINE'[Closed Pipeline]="Open")

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.