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
jplanellvCLNT
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...

jplanellvCLNT_0-1617994798872.png

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

 

jplanellvCLNT_1-1617994854350.png

I appreciatte your support.

 

1 ACCEPTED SOLUTION
MisterFry
Resolver III
Resolver III

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. 

View solution in original post

2 REPLIES 2
V-pazhen-msft
Community Support
Community Support

@jplanellvCLNT 

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"))

 

If not working please share your formula for the MT_Exc measure.

 


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

MisterFry
Resolver III
Resolver III

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. 

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.