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

The FabCon + SQLCon recap series starts April 14th at 8am Pacific. If you’re tracking where AI is going inside Fabric, this first session is a can't miss. Register now

Reply
aboliverABC
Frequent Visitor

Creating Table with DAX from Multiple Tables

I am trying to utilize DAX to create a table (not power query), to help summarize the turnaround time between to services.  Service 1 occures before Service 2.  I ultimately want to know the time between the 1st time Service 2 starts for a customer [in a porgram] (minimum) from the most recent time Service 1 stopped (maximum & <Service 2 start).  The other thing that must be considered, is the Status of both services must = Completed. 

aboliverABC_1-1679431327634.png

 

I know I have to start with summarizing the Service2 table, since that dictates if the Program/Customer combination is in the results table.  I am currently using:  SUMMARIZE(filter(Service2,Service2[Status]="Completed"),Service2[Program],Service2[Customer],"Service2_Start",min(Service2[Start])

 

However, I don't know how to bring in the maximum stop values from Service1 table that corresponds to the same Program/Customer, where Service 1 has a status = completed, and is less than Service2 Start time for that Program/Customer.

 

And then, I don't know how to add a calculated column using the datediff dax formula between the 2 time periods.  

 

5 REPLIES 5
Ahmedx
Super User
Super User

like that you need?
Screen Capture #729.png

Ahmedx
Super User
Super User

And if greater than service2[Start], what should be the result?

then that Service1[Stop] should not be considered.  Only the max Service1[Stop] prior to Service2[start]. In real world terms, Service 2 can't start until Service 1 is complete, however there can be multiple Serivce 1 encounters that don't have anything to do with Service 2. 

Ahmedx
Super User
Super User

Based on your description, I created data to reproduce your scenario. The pbix file is attached in the end.
https://1drv.ms/u/s!AiUZ0Ws7G26RhlKkoyP5UeW6piC_?e=4ZChba
Screen Capture #717.png

thank @Ahmedx for your quick and detailed response.  Also, the solution needs to take into consideration that the MAX service1[Stop] is not greater than service2[Start].  How do I encorporate that, another && in the Filter? 

Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.