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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more

Reply
Anonymous
Not applicable

How to calculate this measure

I have a base table 'Orders' with a column OrderNo, this column is being used in a visual.

 

I have another table 'Operations' with columns: OrderNo, OperationNo, TimeTaken (this is just a numeric column). This table is related to base table with OrderNo. Please note that one OrderNo can have multiple OperationNo.

 

I want to add a column to my visual 'TimeRemaining', which takes all OperationNo (from Operations table) for an OrderNo and sums the TimeTaken column.

 

How can I achieve this?

6 REPLIES 6
Anonymous
Not applicable

Hi @Anonymous ,

 

I made a sample data as follows.

vstephenmsft_0-1634194130228.png

 

Try this measure

 

SUM BY OrderNo =
CALCULATE (
    SUM ( Operations[TimeTaken ] ),
    FILTER ( ALLSELECTED ( Operations ), [OrderNo] = MAX ( 'Operations'[OrderNo] ) )
)

 

13.png

Please check my attachment.

 

 

Best Regards,

Stephen Tao

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Anonymous
Not applicable

Anonymous
Not applicable

Thank you for the reply.

 

I see that this formula and using a SUM(TimeTaken) yields the same result.

 

I will open a new question for this one, as the problem seems to be elsewhere.

amitchandak
Super User
Super User

@Anonymous , hope these tables are joined on the order number.

 

If you are using the duration/time type column, you need to do little bit of work to add that

 

refer if these can help in that

https://radacad.com/calculate-duration-in-days-hours-minutes-and-seconds-dynamically-in-power-bi-using-dax
https://social.technet.microsoft.com/wiki/contents/articles/33644.powerbi-aggregating-durationtime-in-dax.aspx

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
Anonymous
Not applicable

The TimeTaken column can just be treated as numeric column. Yes, the tables are joined on OrderNo. I have updated the question

@Anonymous , if you need a new column  in Table1

 

sumx(relatedtable(Table2), Table2[Time taken])

 

in case of measure

sum( Table2[Time taken]) 

 

should do

 

refer 4 ways to copy data from one table to another
https://www.youtube.com/watch?v=Wu1mWxR23jU
https://www.youtube.com/watch?v=czNHt7UXIe8

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors