Forum Discussion
PowerRobots99
Helper II
2 years agoDate filling tricky challenge
Hi everyone, I am having a table like this, Now, for the first blank in Dates column (7/14/24 - 1212 - Blank) row, we have to get date value from previous week i.e 7/5/2024 and for the secon...
- 2 years ago
Hi PowerRobots99 ,
Below is the code that returns you the value from the previous known week for the selected PO.
This is a calculated column that fills in values that are empty.Correct Date = VAR CurrentPO = [PO] VAR CurrentReportDate = [ReportDate] VAR PreviousReportDate = CALCULATE( MAX(comm[ReportDate]), FILTER( comm, comm[PO] = CurrentPO && comm[ReportDate] < CurrentReportDate ) ) VAR LastDateInPreviousReportDate = CALCULATE( MAX(comm[Dates]), FILTER( comm, comm[PO] = CurrentPO && comm[ReportDate] = PreviousReportDate && NOT(ISBLANK(comm[Dates])) ) ) RETURN IF( ISBLANK([Dates]), LastDateInPreviousReportDate, [Dates] )Result:
Memorable Member | Former Super User
If I helped, please accept the solution and give kudos!
Linkedin
lkalawski
Resident Rockstar
2 years agoHi PowerRobots99 ,
Below is the code that returns you the value from the previous known week for the selected PO.
This is a calculated column that fills in values that are empty.
Correct Date =
VAR CurrentPO = [PO]
VAR CurrentReportDate = [ReportDate]
VAR PreviousReportDate =
CALCULATE(
MAX(comm[ReportDate]),
FILTER(
comm,
comm[PO] = CurrentPO &&
comm[ReportDate] < CurrentReportDate
)
)
VAR LastDateInPreviousReportDate =
CALCULATE(
MAX(comm[Dates]),
FILTER(
comm,
comm[PO] = CurrentPO &&
comm[ReportDate] = PreviousReportDate &&
NOT(ISBLANK(comm[Dates]))
)
)
RETURN
IF(
ISBLANK([Dates]),
LastDateInPreviousReportDate,
[Dates]
)
Result:
| Memorable Member | Former Super User If I helped, please accept the solution and give kudos! |
- PowerRobots992 years ago
Helper II
Thank you for the reply,
Could you please share the .pbix file, many thanks...
- PowerRobots992 years ago
Helper II
Perfect !!!
Thank you so much !!!