Forum Discussion
Date Management
- 6 years ago
Since you posted in two places, I had to take a shot at this one. Turned out to be a little tricky, and solved more easily in DAX IMO. I put your data into a table called "Schedule" and added these two calculated columns to get your desired result. If it works for you and you want explanation of how it works, please let me know.
Priority = SWITCH(Schedule[Subject], "call sheet",1,"Assesories",2,"Maintanance",3,"Tentatively available",4)Adj Start Time =var starttime = Schedule[Start Time]var endtime = Schedule[End Time]var currentpriority = Schedule[Priority]var conflictTF = CALCULATE(COUNTROWS(Schedule), All(Schedule), Schedule[Priority]<currentpriority, Schedule[Start Time]<endtime, Schedule[End Time]>starttime)>0 // returns True or False if a higher priority meeting conflicts with this meetingreturn if(conflictTF, CALCULATE(MAX(Schedule[End Time]), All(Schedule), Schedule[Priority]<currentpriority, Schedule[Start Time]<endtime, Schedule[End Time]>starttime),starttime) // if a conflict, finds the max end time of any conflicting higher priority meetings
Since you posted in two places, I had to take a shot at this one. Turned out to be a little tricky, and solved more easily in DAX IMO. I put your data into a table called "Schedule" and added these two calculated columns to get your desired result. If it works for you and you want explanation of how it works, please let me know.
For some reason it is not returning the right start time. Could this be because this formula searches a whole table rather than by day? I am geting 5:30pm Start time for every value.
- mahoneypat6 years agoMicrosoft Employee
Please confirm you are using the expression in calculated columns and not a measure (expression would need to be adjusted for measure). Did it work when you apply it to the sample data your provided? Are there differences with your actual data? Did you have to modify the expression?
Regards,
Pat
- ConnorH6 years agoMicrosoft Employee
Hi Pat,
Just went through and yes it does work on the sample data but not my actual data. I should have put out a more rounded example. Thank you so much for your time. I have linked to an Excel file which holds an almost itentical match to my actual data. I think an issue was I have hundereds of different days but from what I understood from the solution is it searches the whole table and adjusts start dates instead of adjusting day by day. Not really sure how to do it. Dropbox Excel File
Thank you for the help!