Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

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
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

Find out what's new and trending in the Fabric Community.