Forum Discussion
Add Missing Date Rows to Table based on ID, Date, and Status
- 7 years ago
Hi Everyone,
I was able to solve this using a table and a dynamic column.
Initial 'Daily Burndown' generates a table that assigns every date to an ID.
Daily Burndown = VAR myCalendar = CALENDAR ( MIN ( Table[dayMonthYear] ), MAX ( Table[dayMonthYear] ) ) VAR CJ = CROSSJOIN ( myCalendar, Table ) VAR WR = ADDCOLUMNS ( SUMMARIZE ( CJ, [Date], [ID] ), "Update Date", LOOKUPVALUE ( Table[dayMonthYear], [dayMonthYear], [Date], [ID], [ID] ) ) RETURN WRNext I need to add a column to the new 'Daily Burndown' table to determine what the status is on the days that are not populated in the original table.
This code determines the last time a date changed and populates the blank rows with the earliest date before the next date. Once we have that date, we can use a LOOKUP from the original table the exact status and populate that in the row.
Report Status = VAR previousrow = TOPN ( 1, FILTER ( 'Daily Burndown', [ID] = EARLIER ( [ID] ) && [Date] < EARLIER ( [Date] ) && 'Daily Burndown'[Update Date] <> BLANK () ), [Date], DESC ) VAR row_2 = IF ( 'Daily Burndown'[Update Date] = BLANK (), MINX ( previousrow, [Date] ), [Date] ) VAR look_up = LOOKUPVALUE ( Table[Report Status], Table[ID], [ID], Table[dayMonthYear], row_2 ) RETURN look_up
Hi Everyone,
I was able to solve this using a table and a dynamic column.
Initial 'Daily Burndown' generates a table that assigns every date to an ID.
Daily Burndown =
VAR myCalendar =
CALENDAR (
MIN ( Table[dayMonthYear] ),
MAX ( Table[dayMonthYear] )
)
VAR CJ =
CROSSJOIN ( myCalendar, Table )
VAR WR =
ADDCOLUMNS (
SUMMARIZE ( CJ, [Date], [ID] ),
"Update Date", LOOKUPVALUE ( Table[dayMonthYear],
[dayMonthYear], [Date],
[ID], [ID]
)
)
RETURN
WR
Next I need to add a column to the new 'Daily Burndown' table to determine what the status is on the days that are not populated in the original table.
This code determines the last time a date changed and populates the blank rows with the earliest date before the next date. Once we have that date, we can use a LOOKUP from the original table the exact status and populate that in the row.
Report Status =
VAR previousrow =
TOPN (
1,
FILTER (
'Daily Burndown',
[ID] = EARLIER ( [ID] )
&& [Date] < EARLIER ( [Date] )
&& 'Daily Burndown'[Update Date] <> BLANK ()
),
[Date], DESC
)
VAR row_2 =
IF (
'Daily Burndown'[Update Date] = BLANK (),
MINX ( previousrow, [Date] ),
[Date]
)
VAR look_up =
LOOKUPVALUE (
Table[Report Status],
Table[ID], [ID],
Table[dayMonthYear], row_2
)
RETURN
look_up
Hello David,
This is exactly what I need but I'm not sure about how to use this portion of your daily burndown code. Do all of these fields refer to your table you provided? You have a daymonthyear column so I assume the first two in the code refer to the same column? What about "[Date]", what does that mean?
LOOKUPVALUE ( Table[dayMonthYear],
[dayMonthYear], [Date],
[ID], [ID]
- brickhouse35396 years agoFrequent Visitor
- Anonymous5 years agoNot applicable
Hi,
I don't get what date fields are you using. Can you please describe this is a bit detail, it would help me very much.
Thanks,
Rahul.