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

SUMIF Equivalent in Power BI

I have two unrelated tables that I am trying to perform a simple SUMIF calcluation on. I can easily do this in Microsoft Excel but am struggling to get it completed in Power BI. The simplified scenario is described below. Both tables in my Power BI model are loaded using DirectQuery.

 

Table1: Sales Summary

     Column B: Equivalent Payroll Finish Date

     Column C: Revenue

 

Table2: Payroll

     Column B: Payroll Finish Date

     Column C: Payroll Amount

     Column E (Calculated): Same Finish Date Revenue

 

In 'Table2 [Column E]' I'm trying to calculate the total revenue for the same payroll finish date listed in Table1. This is easily completed in excel using the following formula: "=SUMIF('Sales Summary'!$B$3:$B$7,Payroll!B3,'Sales Summary'!$C$3:$C$7)"

 

How could I go about completing this in Power BI? I can't get the "CALCULATE(SUM..." function to filter properly.

 

Thank you for any help as I've been working on this for a couple days now!

 

Table 1 Example.png

 

 Table 2 Example.png

 

 

 

 

 

 

 

 

 

 

1 ACCEPTED SOLUTION
v-yuezhe-msft
Employee
Employee

Hi @dti,

Create a calendar table in the current database of SQL Server which you get data from following the guide in this blog, then import the calendar table to your current Power BI Desktop file, and link the calendar table to Sales summary table and Payroll table using Datekey.


This way, you will be able to get your desired result after creating a table visual by using datekey of calendar table and Payroll Amount solumn of Payroll table and Revenue of Sales summary table .

Thanks,
Lydia Zhang

Community Support Team _ Lydia Zhang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

12 REPLIES 12

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.