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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
LearnerMM
New Member

Substract time columns from diff datasets

Dear Mentors,

 

I need to substarct column "EST Start" from "EST" ...basically trying to calculate delay.

"EST" indicates schedule - Source is dataset1

"EST Start"  indicate actual start time - source is dataset2

 

Both dataset1 and dataset2 are connected using manage relationship.

 

Could you guide me how can I substract below columns from each other - to get delay in minutes? 

 

LearnerMM_0-1741496992129.png

 

12 REPLIES 12
v-karpurapud
Community Support
Community Support

Hi @LearnerMM 

I wanted to check if you had the opportunity to review the information provided. Please feel free to contact us if you have any further questions. If my response has addressed your query, please accept it as a solution and give a 'Kudos' so other members can easily find it.

Thank you.

 

v-karpurapud
Community Support
Community Support

Hi @LearnerMM 

We are following up to see if your query has been resolved. Should you have identified a solution, we kindly request you to share it with the community to assist others facing similar issues.

If our response was helpful, please mark it as the accepted solution and provide kudos, as this helps the broader community.

Thank You!

Anonymous
Not applicable

Hi @LearnerMM,

Any update on this? Can you please share some dummy data that keep the raw data structure with expected results? It should help us clarify your scenario and test to coding formula.

How to Get Your Question Answered Quickly  

Regards,

Xiaoxin Sheng

rohit1991
Super User
Super User

Hi ,
To calculate the delay in minutes between the "EST Start" (actual start time from dataset2) and "EST" (scheduled time from dataset1), you need to ensure that both datasets are properly related using a common key in Manage Relationships. Once the relationship is set, you can create a new calculated column or measure in Power BI using DAX. The difference between these two time columns can be computed by converting them into a datetime format and subtracting them. Since the result of subtracting time values is in days, multiplying by 1440 (minutes per day) converts it into minutes. Below is the DAX formula to achieve this:
1)  DAX Query for Delay Calculation (in Minutes)
DelayMinutes =
DATEDIFF(SELECTEDVALUE(Dataset1[EST]), SELECTEDVALUE(Dataset2[EST Start]), MINUTE)

2) Alternatively, if working with a calculated column:
DelayMinutes =
(Dataset2[EST Start] - Dataset1[EST]) * 1440

This will return the delay in minutes, where positive values indicate a late start, and negative values indicate an early start. If needed, you can also use ABS(DelayMinutes) to get the absolute delay.

 

 


Did it work? ✔ Give a Kudo • Mark as Solution – help others too!

Hey Thanks @rohit1991 @Deku @danextian  ...... actually problem is - It dose not pull out column name from other datasource.

 

We can substract 2 columns from same data source - but if you try to select another datasource columns , Power BI is not giving me option to select from other datasource. 

 

Can  Iconnect with anyone of you ? 

 

Thanks

Mangesh M

Can you please show your diagram/relationship view? If there's a direct  one-to-many relationship between the two tables, you should be able to use RELATED on the many side. The RELATED function cannot be used on the "one" side of a one-to-many relationship because there could be multiple matching rows in the related table, and RELATED does not perform aggregation.





Dane Belarmino | Microsoft MVP | Proud to be a Super User!

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


"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.
Deku
Community Champion
Community Champion

Datediff( datum[EST start], datum[EST], minutes)


Did I answer your question?
Please help by clicking the thumbs up button and mark my post as a solution!

Hey Thanks @Deku  ...... actually problem is - It dose not pull out column name from other datasource.

 

We can substract 2 columns from same data source - but if you try to select another datasource columns , Power BI is not giving me option to select from other datasource. 

 

Can  Iconnect with anyone of you ? 

 

Thanks

Mangesh M

danextian
Super User
Super User

Hi @LearnerMM 

 

By "manage relationship" you mean there is a direct relationship between the two tables or is there a dimension table in between? Which one's on the many side? Which one's on the one side? Some functions will work depending on which side of the relationship the table is? Please show your diagram.





Dane Belarmino | Microsoft MVP | Proud to be a Super User!

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


"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.

Yes,  there is a direct relationship between the two tables

Hey Thanks @danextian  ...... actually problem is - It dose not pull out column name from other datasource.

 

We can substract 2 columns from same data source - but if you try to select another datasource columns , Power BI is not giving me option to select from other datasource. 

 

Can  Iconnect with anyone of you ? 

 

Thanks

Mangesh M

@LearnerMM 

Please provide the details of the relationship you created. For example if [EST] column is in Table1 and [EST Start] column is in Table2 and if I assume you created 
One to Many relationship between these two 

Table1 on one side and Table2 on the many side then you can follow this DAX measure syntax 

Delay = SUMX(Table2, Datediff(Related(Table1[EST]),  Table2[EST Start], Minute  ) )

 

Need a Power BI Consultation? Hire me on Upwork

 

 

 

Connect on LinkedIn

 

 

 








Did I answer your question? Mark my post as a solution!
If I helped you, click on the Thumbs Up to give Kudos.

Proud to be a Super User!


PBI_SuperUser_Rank@2x.png

 

Helpful resources

Announcements
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.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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