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

Calculate efficiency using two tables

Hi all,

 

I have two tables which have a relationship using weeks columns. RSZA0003_available Hour is my machine weekly available hours

Screenshot 2024-01-18 171832.png

 

In Sizing_Machine table, i have a measure name 'Runtime" now i would like to see the efficency of my machine over the past few weeks. I've tried to use the following code to calculate. But for some reason when i use related function, power bi didnt recognise the column. 

 
Efficencey = VAR runtime = [Run Time in Minute]
var _hour = RELATED('RSZA0003_Avaiable Hour'[Total available Hour])
var efficency_1 = runtime / _hour
    return efficency_1
 
May i ask for some advice? Thanks in advanced.
4 REPLIES 4
Anonymous
Not applicable

Hi @Hongmingk 

 

I would like to apologize for the belated reply.

 

Have you solved your problem? If not, here is my suggestion: You could try changing the RELATED formula to a SELECTEDVALUE formula.

 

For more details, you can read related document link: SELECTEDVALUE function - DAX | Microsoft Learn

 

Since I can't see your screenshot clearly, I apologize for not being able to reproduce your formula. If your problem persists, you can refer to the following link to provide example data and your expected results:  How to provide sample data in the Power BI Forum - Microsoft Fabric Community. We can better understand the problem and help you. Please remove any sensitive data in advance. 

 

Best Regards,
Community Support Team _Yuliax

Daniel29195
Super User
Super User

hello @Hongmingk 

to use related, you need an iterator such as sumx, max, minx, filter, addcolumns , .... .

 

assuming that the total available hour is additive across dimensions,  i guess  you can simply use : 

Efficencey = 
VAR runtime = [Run Time in Minute]
var _hour = sum('RSZA0003_Avaiable Hour'[Total available Hour])
var efficency_1 = runtime / _hour
    return efficency_1

 

let me know if you need any help 

best regards,

Hi,

 

Thanks for the help and really appericated. But unfortunately the answer is not im looking for. I'm sorry for not being clear on my issue. Let me elobrate. 

 

The picture below show the RSZA0003_Avaiable Hour'

Hongmingk_0-1705636887426.jpeg

 

 

If i use sum('RSZA0003_Avaiable Hour'[Total available Hour]). The result will be wrong. As you can see in the picture below. 

 

 

By right, if i want to calculate the efficency, i would need to use runtime / total available hour. Hence i should have the result as below 

Week 1 : 0.565

Week 2 : 0.589

Week 3 : 0.528

 

As you can see in the picture below, the "Total avaiable hour" is straight away input into the table. This two table RSZA_avaiable hour and sizing machine have a relationship using weeks. 

 

Hongmingk_2-1705636887263.jpeg

 

 

Thanks in advanced and sorry for the trouble.

 

ValtteriN
Super User
Super User

Hi,

To make RELATED work in a measure you need to use some table manipulating function E.g.

Measure 14 =

var _vtable = ADDCOLUMNS('Table (16)',"A",RELATED('Calendar'[Year])) RETURN
MAXX(_vtable,[A])

ValtteriN_0-1705571540441.png

 

I hope this post helps to solve your issue and if it does consider accepting it as a solution and giving the post a thumbs up!

My LinkedIn: https://www.linkedin.com/in/n%C3%A4ttiahov-00001/




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




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.

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.