Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
Person | Phase | Status | DateTime |
Peter | Sleeping | Running | 04/03/2019 13:06 |
Peter | Sleeping | Running | 04/03/2019 13:07 |
Peter | Sleeping | Complete | 04/03/2019 13:08 |
John | Eating | Running | 05/03/2019 14:06 |
John | Eating | Complete | 05/03/2019 14:26 |
Marcus | Studying | Running | 07/03/2019 15:16 |
Marcus | Eating | Running | 07/03/2019 15:45 |
Marcus | Studying | Complete | 07/03/2019 15:46 |
Marcus | Eating | Complete | 07/03/2019 15:56 |
Solved! Go to Solution.
Hi, @Anonymous
Based on your description, I created data to reproduce your scenario. The pbix file is attached in the end.
Table:
You may create a calculated column as below.
End Date =
CALCULATE(
MIN('Table'[DateTime]),
FILTER(
ALL('Table'),
'Table'[Person]=EARLIER('Table'[Person])&&
'Table'[Phase]=EARLIER('Table'[Phase])&&
'Table'[Status]="Complete"&&
'Table'[DateTime]>=EARLIER('Table'[DateTime])
)
)
Result:
Best Regards
Allan
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi there, basically you can use EARLIER here. This function is explained fully in this video with practical examples. Nowadays we use variables vastly to replace EARLIER but learing this function helps deepen your DAX a lot:
Hi, @Anonymous
Based on your description, I created data to reproduce your scenario. The pbix file is attached in the end.
Table:
You may create a calculated column as below.
End Date =
CALCULATE(
MIN('Table'[DateTime]),
FILTER(
ALL('Table'),
'Table'[Person]=EARLIER('Table'[Person])&&
'Table'[Phase]=EARLIER('Table'[Phase])&&
'Table'[Status]="Complete"&&
'Table'[DateTime]>=EARLIER('Table'[DateTime])
)
)
Result:
Best Regards
Allan
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @Anonymous ,
Not very clear.
YOu can try
New Column = CALCULATE(MAX(Table[DateTime] , Filter(Table, Table[Name] =earlier(Table[Name]) && Table[Phase] =earlier(Table[Phase]) && Table [Status]="Complete"))
New Column = Calculate (MAX(Table[DateTime]), Table[Status] = "Complete")
Else
New Column = IF( Table[Status] = "Complete", Table[DateTime] , BLANK())
Regards,
Harsh Nathani
Did I answer your question? Mark my post as a solution! Appreciate with a Kudos!! (Click the Thumbs Up Button)
@Anonymous , try new column like
maxx(filter(Table, [Name] =earlier([Name]) && [Phase] =earlier([Phase]) && [Status]="Complete"),[DateTime])
or
maxx(filter(Table, [Phase] =earlier([Phase]) && [Status]="Complete"),[DateTime])
Thank you for the prompt response. I have to make a status bar. That's why I need to know the start time and the end time of a phase. The maxx(filter(Table, [Phase] ?earlier([Phase]) && [Status]"Complete"),[DateTime]) function would solve the problem if that phase only occurred once, but in my case that phase occurs in several days and on some days several times during that day. So the maxx(filter(Table, [Phase] ?earlier([Phase]) && [Status]"Complete"),[DateTime]) function would give me the maximum date of the last time the phase is completed. Any idea for that every time there is that phase me from the date of the next state completed that phase? Thanks for the help.
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
113 | |
99 | |
80 | |
70 | |
60 |
User | Count |
---|---|
149 | |
114 | |
107 | |
89 | |
67 |