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
larabraghetti
Helper II
Helper II

Help... SUM.IF in Power BI?

Dear all,

 

I' like to build a new column formula like this one:
=SUM.IF(COLUMN[Portfolios];COLUMN[Portfolios]=ROWn;MARKET VALUE)

 

I try to explain: I'd like to have for each line with the same portfolio, the sum of the market value of the portfolio.

So for all rows with portfolio1 I will have always the same number (the sum of market value of this portfolio).

I don't know how to do this in Power BI. 
Please, could you help me?
Thank you!
Lara

1 ACCEPTED SOLUTION
leonardmurphy
Skilled Sharer
Skilled Sharer

This is certainly possible in Power BI. Try:

 

 

Portfolio Market Value = CALCULATE(SUM([Market Value]), ALLEXCEPT(TableName, TableName[Portfolio]))

 

 

(Assuming your table is called TableName and it has at least 2 columns: Portfolio and Market Value.)

 

The SUM([Market Value]) in a calculated column will calculate just the sum of the row it is in. By wrapping it in a CALCULATE with an ALLEXCEPT clause, the ALLEXCEPT says "remove all filters on this table, except the filter on Portfolio". The entire formula is saying "I want to sum the Market Value for every row in my table where the portfolio is the same as the portfolio in the current row.

 

 

---
In Wisconsin? Join the Madison Power BI User Group.

View solution in original post

2 REPLIES 2
leonardmurphy
Skilled Sharer
Skilled Sharer

This is certainly possible in Power BI. Try:

 

 

Portfolio Market Value = CALCULATE(SUM([Market Value]), ALLEXCEPT(TableName, TableName[Portfolio]))

 

 

(Assuming your table is called TableName and it has at least 2 columns: Portfolio and Market Value.)

 

The SUM([Market Value]) in a calculated column will calculate just the sum of the row it is in. By wrapping it in a CALCULATE with an ALLEXCEPT clause, the ALLEXCEPT says "remove all filters on this table, except the filter on Portfolio". The entire formula is saying "I want to sum the Market Value for every row in my table where the portfolio is the same as the portfolio in the current row.

 

 

---
In Wisconsin? Join the Madison Power BI User Group.

Thanks!
It works. Well done.

Lara

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.