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

Get certified in Microsoft Fabric—for free! For a limited time, the Microsoft Fabric Community team will be offering free DP-600 exam vouchers. Prepare now

Reply
att9728
New Member

Create calculated column for start and end date

I am working with the following two tables:

  1. Data sample table, this is showing data collected with a "stage" identifier as well as the time it was collected. 
    1. TimeStageValue1Value2
      5/22/2020 13:01:15  1  
      5/22/2020 13:02:15  1  
      5/22/2020 13:03:15  1  
      5/22/2020 14:01:15  2  
      5/22/2020 14:02:15  2  
  2. Stage Summary Table, this is showing summaries from the stage (The desired output). 
    1. StageStartEnd
      15/22/2020 13:01:155/22/2020 13:03:15
      25/22/2020 14:01:155/22/2020 14:02:15

 

These tables are realted via stage number. For table 2, where I am having issues is calculating the Start and End Time. For start time, it needs to filter data 1 by corresponding stage and find the first time. 

 

I have tried the following DAX expression, but am getting odd results: 

 

 

 

 

 

 

Start = CALCULATE(FIRSTDATE(ParameterValues[date].[Date]),USERELATIONSHIP(ParameterValues[stageId],Stages[_id]))

 

 

 

 

 

 

Every row is returning 1/1/2020 12:00:00 AM for start and 12/31/2020 12:00:00 AM for end, but neither of these values are in the table.

 

Im sure I am making a simple mistake, but have been stuck and cannot get it figured out. Thank you in advance for the help!!

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@att9728 , Not very clear, Both as a new column in table 2

start Time table 2 = minx(filter(table1,table1[Stage] =table2[Stage]),table1[Time])
End Time table 2 = maxx(filter(table1,table1[Stage] =table2[Stage]),table1[Time])

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here

View solution in original post

2 REPLIES 2
amitchandak
Super User
Super User

@att9728 , Not very clear, Both as a new column in table 2

start Time table 2 = minx(filter(table1,table1[Stage] =table2[Stage]),table1[Time])
End Time table 2 = maxx(filter(table1,table1[Stage] =table2[Stage]),table1[Time])

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here

Thank you for this! This is the answer. 

Helpful resources

Announcements
OCT PBI Update Carousel

Power BI Monthly Update - October 2024

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

September Hackathon Carousel

Microsoft Fabric & AI Learning Hackathon

Learn from experts, get hands-on experience, and win awesome prizes.

October NL Carousel

Fabric Community Update - October 2024

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

Users online (2,931)