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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
rmorris
Frequent Visitor

Equivalent of Excel SUMIFS between two tables

Hi,

 

New to PowerBI so a steep learning curve, but how to i acheive the following. (i didnt design tables, legacy from previous team)

 

Table 1, contains the Job#, Line# and the Type of job that it is.

 

Job# Line#Type
C4662 1C
C4662 2W
C4662 3C
C4662 4I
C4662 5C
C5000 1C

 

Table 2, contains the Job# and Line# but  details the time spent on each line.

 

Job# Line#Time Spent
C4662 11.5
C4662 23.5
C4662 36.2
C4662 40.7
C4662 51.2
C5000 110.2

 

I have a third table that is a summary table where i need to add three columns that will show the sum of time spent by each line type. This is what the end results needs to look like. Do i add these as new columns, or a measure, and what function do i use to achieve it?

Job# Type C TimeType I TimeType W Time
C4662 8.90.73.5
C5000 10.20.00.0

 

 

Job# is the only current relationship between tables

 

Thank you

1 ACCEPTED SOLUTION
Greg_Deckler
Super User
Super User

@rmorris For SUMIF you can use SUMX(FILTER(),...) or CALCULATE like:

Type C Time Column =
  VAR __Job = [Job#]
  VAR __Lines = SELEECTCOLUMNS(FILTER('Table1',[Job#] = __Job && [Type] = "C"),"__Line",[Line#])
RETURN
  SUMX(FILTER('Table2',[Job#] = __Job && [Line#] IN __Lines),[Time Spent])

Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

View solution in original post

2 REPLIES 2
Greg_Deckler
Super User
Super User

@rmorris For SUMIF you can use SUMX(FILTER(),...) or CALCULATE like:

Type C Time Column =
  VAR __Job = [Job#]
  VAR __Lines = SELEECTCOLUMNS(FILTER('Table1',[Job#] = __Job && [Type] = "C"),"__Line",[Line#])
RETURN
  SUMX(FILTER('Table2',[Job#] = __Job && [Line#] IN __Lines),[Time Spent])

Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

Thank you so much, worked a treat!

Helpful resources

Announcements
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel1

Power BI Monthly Update - May 2024

Check out the May 2024 Power BI update to learn about new features.

Top Solution Authors