2024: Week 44 - Solution
Video Solution Solution by Tom Prowse and you can download the workflow here . Step 1 - Sold & Returned First we want to tidy the dates a item was sold or returned so that the return date isn't before a sale date. We can identify any issues by creating an issue flag: Issue? [Date Sold]>=[Date Returned] Then using this to recalculate the Order or Return date: Order Date IF [Issue?] THEN [Date Returned] ELSE [Date Sold] END Return Date IF [Issue?] THEN [Date Sold] ELSE [Date Returned] END We can then remove the Issue?, Date Sold, & Date Returned fields. Finally, we can calculate how many days it took to return an item by using a DateDiff function: Days to Return DATEDIFF('day',[Order Date],[Return Date]) And also calculate what the value of the returned items are: Return Value IF [Days to Return]<=60 THEN [Price ] ELSEIF [Days to Return]<=100 THEN round([Price ]*0.5,2) ELSEIF [Days to Return]>100 THEN 0 END At this stage our table looks like this