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

Recreating SUMIFS formula with Calculate and FILTERS, so that conditions can equal values in rows

Hi ,

 

I'm trying to create a new column in Table 2 in Power BI (example below already has the columns..), by taking the Revenue from the Details table, by not using a Measure. I have way too many Clients to write a condition for every client, so need a IF/FILTER or another function to serve this purpose similar to a SUMIFS in excel. So that if my table changes clients/affiliation, the revenue would adjust with it.

 

This is the current formula I have, but it obviously doesn't work.

2017A = CALCULATE(

sum('Details'[Revenue]),

FILTER('Details','Details'[Affiliation] = Table 2[Affiliation] ),

FILTER('Details', 'Details'[Client] = Table 2[Client] ),

FILTER('Details', 'Details'[Month] = "April - 2017" )

)

 

This is an example of the tables I have.

 

Details
    
AffiliationClientYearMonthRevenue
AAPPLE2017April - 2017100
AAPPLE2018

May - 2017

200
BAPPLE2017April - 2017300
BAPPLE2018May - 2017400
     
Table 2    
AffiliationClient20172018 
AAPPLE100200 
BAPPLE300400 
1 ACCEPTED SOLUTION
az38
Community Champion
Community Champion

@AldoJavier26 

why dont you want to use a measures?

anyway in your technique correct syntax should look like

2017A = CALCULATE(
sum('Details'[Revenue]),
FILTER(ALL('Details'),'Details'[Affiliation] = Table 2[Affiliation] && 'Details'[Client] = Table 2[Client] && 'Details'[Month] = "April - 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

View solution in original post

3 REPLIES 3

Hi @AldoJavier26 ,

 

you could create a calculated table like this:

Table 2 = SUMMARIZE(Details,Details[Affiliation],Details[Client],"2017",CALCULATE(SUM(Details[Revenue]),Details[Year]=2017),"2018",CALCULATE(SUM(Details[Revenue]),Details[Year]=2018))

 Regards,

Marcus

Dortmund - Germany
If I answered your question, please mark my post as solution, this will also help others.
Please give Kudos for support.

Did I answer your question?
Please mark my post as solution, this will also help others.
Please give Kudos for support.

Marcus Wegener works as Full Stack Power BI Engineer at BI or DIE.
His mission is clear: "Get the most out of data, with Power BI."
twitter - LinkedIn - YouTube - website - podcast


az38
Community Champion
Community Champion

@AldoJavier26 

why dont you want to use a measures?

anyway in your technique correct syntax should look like

2017A = CALCULATE(
sum('Details'[Revenue]),
FILTER(ALL('Details'),'Details'[Affiliation] = Table 2[Affiliation] && 'Details'[Client] = Table 2[Client] && 'Details'[Month] = "April - 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

Well,  went down the path of creating measures with  IF functions, but found myself not being able to to "pivot" or create filtered visualizations off of these measures.

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.