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

SUMIF for Power BI - Newbie question

Hi,

 

I have two tables with id's that can be linked.

 

On table 1, I have one unqiue ID per row. On table 2 I have a varying amount of rows per ID:

 

Table 1 Table 2

 ID        ID Profit/Loss

188       188 £2.56

189       188 £123.54

 

In table two, each row has a column providing £ value which I need to sum to give a total per ID in table 1. I am trying to use a calculated column in table 1 to do this but can't get a DAX formula to work - bound to me being new to Power BI and DAX formula.

 

Can anyone provide some help here?

4 REPLIES 4
Vvelarde
Community Champion
Community Champion

@Bimster

 

asumming you have a relationship active betwwen both tables

 

the calculated column in Table 1 will be:

 

Profit/Loss = CALCULATE(SUM(Table2[PROFIT/LOSS]))




Lima - Peru

Thanks for the help, I'll try that now.

 

By relationship I take it you mean I have a many to one relationship set up with the many on the table 2 side.

@Bimster

 

In this scenario, either calculated column or measure can work.

 

5.PNG

 

You can understand it like calculated column is resolving the calculation on row level, and the measure will aggregate the data on slicing level. For more details, please see: Calculated Columns and Measures in DAX

 

Regards,

 

 

The scenario you have described does not warrant a calculated column, you should be using a measure.

       measure_name = sum('table'[column])

given what you have described you should be able to use your value column directly in visuals, if it is a number it is a intrinsic measure which would be displayed with a sigma on the left in the field well

 



I hope this helps,
Richard

Did I answer your question? Mark my post as a solution! Kudos Appreciated!

Proud to be a Super User!


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.