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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
rmorris
Frequent Visitor

Percentages of time from different tables

I've come accross a beauty that i just cannot work out. I've got staff working on jobs and need to show which staff member is generating the most income for us. the data is sitting in2 tables and i need to present it in a Powerbi matrix. 

 

Table 1

 Contract#  Job#  Time SOLD  Sales Value
 M309252  1  1.5  $450
 M309252  2  2.0  $350
 M304445  1  3.0  $400

 

 

Table 2

 Contract# Job#  Employee#Time SPENT 
 M309252 1  915  0.5 
 M309252 2  960  0.6 
 M304445 1  960  0.8 
 M304445 1  977  1.2 

 

 

In the PowerBI Matrix i need a "Total Time Spent", "Total Time SOLD" & "Total Sales Value", all to be calclauted based on the % of "Time SPENT" between technicians on each perticlaur contract/job line.

 

The end result should look like this in a PowerBI Matrix. I'm sure i'll need some form of measure but have no idea how to do it.

 

 Employee#Total Time SPENT  Total Time SOLD  Total Sales Value 
  915  0.5  1.5  $450 
  960  1.4  3.2  $510 
  977  1.2  1.8  $240 

 

 

 

2 REPLIES 2
tamerj1
Super User
Super User

Hi @rmorris 

create a many to many relationship between the two tables on Contract# then use the following measures

 

Total Time SPENT =
SUM ( Table2[Time SPET] )

 

Total Time SOLD =
SUMX (
Table2,
SUMX (
FILTER ( RELATEDTABLE ( Table1 ), Table1[Job#] = Table3[Job#] ),
Table1[Time SOLD]
)
)

Total Sales Value =
SUMX (
Table2,
SUMX (
FILTER ( RELATEDTABLE ( Table1 ), Table1[Job#] = Table3[Job#] ),
Table1[Sales Value]
)
)

BrianConnelly
Resolver III
Resolver III

In both tables, you need to create a composite key (calculated column: M309252-1) and create a relationship.  Then create a summary table.

 

SummaryTable =

SUMMARIZECOLUMNS('Table2'[Employee],"Total Time Spent", SUM('Table2'[TimeSpent]),"Total Time SOLD",SUM('Table1'[TimeSold]) ,"Total Sales Value",SUM('Table1'[SalesValue])

 

You can then create measures on top of this table.

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

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

MayPowerBICarousel

Power BI Monthly Update - May 2024

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

LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

Top Solution Authors