cancel
Showing results for
Did you mean:
New Member

## Summarize categories of different columns

Hi everyone, I have two columns with product categories... Each column have their own measure (in this case produced tons)... I need to summarize the content of both category columns and show the Sum for each category... In Excel it´s easy  using "IF" but I don´t find the right way to do this in Power BI...

this is the summary of the previous image, in this case I need to calculate the sum of MT + MT keeping the categories... My expected result its have Clarsil = 92 MT

1 ACCEPTED SOLUTION
Resolver I

I'd approach it like this:

MT Total =
VAR thisProduct = SELECTEDVALUE(<your first product field>) RETURN
VAR excessTons = CALCULATE(SUM(<excess tons field>, ALL(<first product field>), <second product field> = thisProduct)) RETURN
SUM(MT) + excessTons

This formula relies on the filter context of your second matrix table to find the indicated product, and apply that product filter to your second field (while ignoring what's in the first) and add the two sums together.

2 REPLIES 2
Community Support

I am not sure what is the dax for this MT_Exc measure, however you could just add another expression to it.

MT_Exc = (current expression) + calculate(sum([MT]), filter(table,[Product]="CLARSIL"))

Paul Zheng _ Community Support Team
If this post helps, please Accept it as the solution to help the other members find it more quickly.

Resolver I

I'd approach it like this:

MT Total =
VAR thisProduct = SELECTEDVALUE(<your first product field>) RETURN
VAR excessTons = CALCULATE(SUM(<excess tons field>, ALL(<first product field>), <second product field> = thisProduct)) RETURN
SUM(MT) + excessTons

This formula relies on the filter context of your second matrix table to find the indicated product, and apply that product filter to your second field (while ignoring what's in the first) and add the two sums together.

Announcements

#### Microsoft Build is May 24-26. Have you registered yet?

Come together to explore latest innovations in code and application development—and gain insights from experts from around the world.

#### The Power BI Community Show

Welcome to the Power BI Community Show! Jeroen ter Heerdt talks about the importance of Data Modeling.

#### Check it out!

Mark your calendars and join us on Thursday, May 26 at 11a PDT for a great session with Ted Pattison!

#### Charticulator Design Challenge

Put your data visualization and design skills to the test! This exciting challenge is happening now through May 31st!

Top Solution Authors
Top Kudoed Authors