Forum Discussion
Calculated column from final acceptance date based on specific previous period from same table
Hello,
I would like compare the [Final acceptance date] from a current line item with the baseline, where the budget was created.
This information can usually be found in the project specific line item of the project, where [Date Key] = 30.09 of the previous year and i would like to write this [Final Acceptance Date] into into a calculated column called [Final Acceptance Date (Baseline)].
If there is no dataset available for September of the previous year, the [Final acceptance date] based on the earliest available [Date Key] for the specific project should be used. Only line items where parameters "Role" = "relevant" and Type = "month" are relevant in this context - the others should be ignored.
Example 1:
For [Project Number] = "123" and [Date Key] = "30.04.2021", the correct value for the new calculated column [Final Acceptance Date (Baseline)] would be 15.10.2021 ([Date Key] from 30.09.2021).
Example 2:
For [Project Number] = "456" and [Date Key] = "31.03.2021", the correct value for the new calculated column [Final Acceptance Date (Baseline)] would be 02.10.2021 ([Date Key] from 28.02.2021).
| Project Number | Date Key | Role | Type | Final Acceptance | ||||
| 123 | 30.04.2021 | relevant | month | 20.12.2022 | ||||
| 123 | 31.03.2021 | relevant | month | 20.12.2022 | ||||
| 123 | 28.02.2021 | relevant | month | 20.12.2022 | ||||
| 123 | 31.01.2021 | relevant | month | 20.12.2022 | ||||
| 123 | 31.12.2020 | relevant | month | 20.12.2022 | ||||
| 123 | 30.11.2020 | relevant | month | 15.10.2021 | ||||
| 123 | 31.10.2020 | relevant | month | 15.10.2021 | ||||
| 123 | 30.09.2020 | relevant | month | 15.10.2021 | ||||
| 123 | 31.08.2020 | relevant | month | 15.10.2021 | ||||
| 123 | 31.07.2020 | relevant | month | 15.10.2021 | ||||
| 123 | 30.06.2020 | relevant | month | 15.10.2021 | ||||
| 123 | 31.05.2020 | relevant | month | 15.10.2021 | ||||
| 123 | 30.04.2020 | relevant | month | 15.10.2021 | ||||
| 123 | 31.03.2020 | relevant | month | 15.10.2021 | ||||
| 123 | 29.02.2020 | relevant | month | 15.10.2021 | ||||
| 123 | 31.01.2020 | relevant | month | 15.10.2021 | ||||
| 123 | 31.12.2019 | relevant | month | 15.10.2021 | ||||
| 123 | 30.11.2019 | relevant | month | 15.10.2021 | ||||
| 123 | 31.10.2019 | relevant | month | 15.10.2021 | ||||
| 123 | 30.09.2019 | relevant | month | 15.10.2021 | ||||
| 123 | 31.08.2019 | relevant | month | 15.10.2021 | ||||
| 123 | 31.07.2019 | relevant | month | 15.10.2021 | ||||
| 123 | 30.06.2019 | relevant | month | 15.10.2021 | ||||
| 123 | 15.06.2019 | relevant | initial | 15.10.2021 | ||||
| 123 | 30.04.2021 | not relevant | month | 20.12.2022 | ||||
| 123 | 31.03.2021 | not relevant | month | 20.12.2022 | ||||
| 123 | 28.02.2021 | not relevant | month | 20.12.2022 | ||||
| 123 | 31.01.2021 | not relevant | month | 20.12.2022 | ||||
| 123 | 31.12.2020 | not relevant | month | 20.12.2022 | ||||
| 123 | 30.11.2020 | not relevant | month | 15.10.2021 | ||||
| 123 | 31.10.2020 | not relevant | month | 15.10.2021 | ||||
| 123 | 30.09.2020 | not relevant | month | 15.10.2021 | ||||
| 123 | 31.08.2020 | not relevant | month | 15.10.2021 | ||||
| 123 | 31.07.2020 | not relevant | month | 15.10.2021 | ||||
| 123 | 30.06.2020 | not relevant | month | 15.10.2021 | ||||
| 123 | 31.05.2020 | not relevant | month | 15.10.2021 | ||||
| 123 | 30.04.2020 | not relevant | month | 15.10.2021 | ||||
| 123 | 31.03.2020 | not relevant | month | 15.10.2021 | ||||
| 123 | 29.02.2020 | not relevant | month | 15.10.2021 | ||||
| 123 | 31.01.2020 | not relevant | month | 15.10.2021 | ||||
| 123 | 31.12.2019 | not relevant | month | 15.10.2021 | ||||
| 123 | 30.11.2019 | not relevant | month | 15.10.2021 | ||||
| 123 | 31.10.2019 | not relevant | month | 15.10.2021 | ||||
| 123 | 30.09.2019 | not relevant | month | 15.10.2021 | ||||
| 123 | 31.08.2019 | not relevant | month | 15.10.2021 | ||||
| 123 | 31.07.2019 | not relevant | month | 15.10.2021 | ||||
| 123 | 30.06.2019 | not relevant | month | 15.10.2021 | ||||
| 123 | 15.06.2019 | not relevant | initial | 15.10.2021 | ||||
| 456 | 30.04.2021 | relevant | month | 10.10.2021 | ||||
| 456 | 31.03.2021 | relevant | month | 10.10.2021 | ||||
| 456 | 28.02.2021 | relevant | month | 01.10.2021 | ||||
| 456 | 16.02.2021 | relevant | initial | 01.10.2021 | ||||
| 456 | 30.04.2021 | not relevant | month | 10.10.2021 | ||||
| 456 | 31.03.2021 | not relevant | month | 10.10.2021 | ||||
| 456 | 28.02.2021 | not relevant | month | 01.10.2021 | ||||
| 456 | 16.02.2021 | not relevant | initial | 01.10.2021 |
I tried to solve this with LOOKUPVALUE in combination with MINX+FILTER for example, but i wasn't sucessfull.
I would highly appreciate if you could help me to solve this problem.
Thank you,
Best regards,
Reinhard
waldnerr , based on what I got, try a new column like
Var _date = date(year([date]),9,30) // convert to date key format if needed
var _date1 = minx(filter(Table, [Project Number] = earlier([Project Number])),[Datekey])
var _prj = [Project Number]
var _op1 = maxx(filter(Table, [Project Number] = _prj && [Datekey] = _date),[Final Acceptance])
var _op2 = maxx(filter(Table, [Project Number] = _prj && [Datekey] = _date1),[Final Acceptance])
return
if(isblank(_op1), _op1, op2)
2 Replies
- amitchandakSuper User
waldnerr , based on what I got, try a new column like
Var _date = date(year([date]),9,30) // convert to date key format if needed
var _date1 = minx(filter(Table, [Project Number] = earlier([Project Number])),[Datekey])
var _prj = [Project Number]
var _op1 = maxx(filter(Table, [Project Number] = _prj && [Datekey] = _date),[Final Acceptance])
var _op2 = maxx(filter(Table, [Project Number] = _prj && [Datekey] = _date1),[Final Acceptance])
return
if(isblank(_op1), _op1, op2) - waldnerrHelper I
amitchandak
You have pointed me into the right direction to make me able to solve the problem.Thank you!
Best regards,
Reinhard