cancel
Showing results for 
Search instead for 
Did you mean: 
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
PBI Sept Update Carousel

Power BI September 2023 Update

Take a look at the September 2023 Power BI update to learn more.

Learn Live

Learn Live: Event Series

Join Microsoft Reactor and learn from developers.

Dashboard in a day with date

Exclusive opportunity for Women!

Join us for a free, hands-on Microsoft workshop led by women trainers for women where you will learn how to build a Dashboard in a Day!

MPPC 2023 PBI Carousel

Power Platform Conference-Power BI and Fabric Sessions

Join us Oct 1 - 6 in Las Vegas for the Microsoft Power Platform Conference.

Top Solution Authors