Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
9 years ago

SUMIF in PowerBI?

So I have two data sets - one named data and one named plan. I need to create a column in the plan dataset that pulls in information from the data dataset. There is a column called "Line" in both datasets that I will be looking up on. Then there is a "Total Amount" column in the data dataset where I want to sum the information from. I've looked up how to do a SUMIF in Power BI before but it seems like there are a number of different ways and they don't really make sense to me.

 

Here is how I would accomplish what I would want to do with a SUMIF formula in Excel:

 

= SUMIF('Data'!LineColumn, 'Plan'!LineColumn, 'Data'!TotalAmountColumn)

 

Where the first argument is a lookup column, the second argument is the value you're looking up on a specific row, and the third argument is column that your summing information from that matches the lookup criteria.

2 Replies

  • v-jiascu-msft's avatar
    v-jiascu-msft
    Icon for Microsoft Employee rankMicrosoft Employee

    Hi Anonymous,

     

    There must be a relationship between these two tables. I guess the table "Plan" is in the 1-side. You could try this formula. The "relatedtable" will find out all the related data and sumx will sum the [Total amount] up.

     

    Column =
    SUMX ( RELATEDTABLE ( Data ), [TotalAmount] )

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

    Best Regards!

    Dale

  • v-jiascu-msft's avatar
    v-jiascu-msft
    Icon for Microsoft Employee rankMicrosoft Employee

    Hi Anonymous,

     

    Could you please mark the proper answer as solution or share the solution if it's convenient for you? That will be a big help to the others.

     

    Best Regards!
    Dale