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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
Rune_
Frequent Visitor

DAX formula to sum a column from another table based on multiple filters in the main table

I have 3 tables:

  • JobHeader
  • JobTask
  • JobPlanningLine

I want to create a table in Power BI that shows Job No and Job Task No from the JobTask table and sums the PlannedSales column from the JobPlanningLine table.

In the JobTask table, for each Job No and Job Task No, there is a sum of different Job Task No called Totaling. So, Job Task No = 199 should be a summary of Totaling == 100..199.

In the JobPlanningLine table, each row contains Job No and JobTaskNo where, for example, it's between 100-198.

I have split the Totaling column into two columns named Totaling.1 and Totaling.2. For example, 100..199 becomes 100 and 199.

Also The LineType should be either 1 or 2. 

I think the formula should be something like: Sum PlannedSales for Job No and Job Task No >= Totaling.1 and <= Totaling.2 and LineType = 1 or 2

The JobTask table should be the main table I work from since I need to perform similar operations on many tables.

I have attached a screenshot of the relationships between tables and an Excel file with sample data.

Relationship between Job No

Rune__0-1694848935127.png


How I want it in PowerBi

Rune__1-1694848975675.png

Link to

Test Data <--- LINK

 

 

Rune__0-1694849378691.png

Job NoStatus
10100Open
10101Quote
10102Invoiced
10103Invoiced
10104Open
10105Quote
10106Invoiced
10107Open
10108Quote

 

 

Job NoJob Task NoTotalingTotaling.1Totaling.2
10100199100..199100199
10100299200..299200299
10100399300..399300399
10101199100..199100199
10101299200..299200299
10101399300..399300399
10102199100..199100199
10102299200..299200299
10102399300..399300399

 

Job NoJob Task NoLine TypePlannedSales
1010011000
101001201100
1010013025000
101001401100000
10100141250000
1 REPLY 1
lbendlin
Super User
Super User

Please provide sample data (with sensitive information removed) that covers your issue or question completely, in a usable format (not as a screenshot). Leave out anything not related to the issue.
https://community.fabric.microsoft.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-...
Please show the expected outcome based on the sample data you provided.

https://community.fabric.microsoft.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447...

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.