Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago

Adding missing date rows and filling in Quantity

Hi, I have a table INVENTORY which has Inv_Date and the respective Quantity, as follows;

 

Inv_DateQuantity
01.01.2021    10
02.01.2021    10
05.01.2021    15
07.01.2021    100

 

I want to fill in the missing date rows and add the Quantity, as follows;

 

Inv_DateQuantity
01.01.2021    10
02.01.2021    10
03.01.2021    10
04.01.2021    10
05.01.2021    15
06.01.2021    15
07.01.2021    100

 

I have created a new table, and used the following DAX script:

 

FullDateTable =
ADDCOLUMNS(
CALENDAR(MIN(INVENTORY[Inv_Date]), MAX(INVENTORY[Inv_Date])),
"Quantity",
LOOKUPVALUE(
INVENTORY[Quantity],
INVENTORY[Inv_Date],
MAXX(
FILTER(INVENTORY, INVENTORY[Inv_Date] <= EARLIER([Inv_Date])),
[Inv_Date]
)
)
)

 

I am getting the error "Column 'Inv_Date' cannot be found or may not be used in this expression."

What am i missing here?