Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.
Greeting, everyone!
I have this table and I want to fill the blank stock values with the next column value, for each product and the date.
Date | Product | Stock |
02/05/2023 | A | |
02/05/2023 | B | |
02/05/2023 | C | |
01/05/2023 | A | |
01/05/2023 | B | 2 |
01/05/2023 | C | 1 |
30/04/2023 | A | |
30/04/2023 | B | |
30/04/2023 | C | 2 |
29/04/2023 | A | 4 |
29/04/2023 | B | 0 |
29/04/2023 | C | |
28/04/2023 | A | |
28/04/2023 | B | 1 |
28/04/2023 | C | 1 |
27/04/2023 | A | 5 |
27/04/2023 | B | 2 |
27/04/2023 | C | 0 |
I tried this new column, but making an error that I am not identifying, i think i'm not getting the right filter.
Expected Value (Wrong) = IF('Table'[Stock]="",
CALCULATE(
FIRSTNONBLANK('Table'[Stock], TRUE() ),
FILTER ( ALLEXCEPT('Table','Table'[Product]), 'Table'[Date] <= EARLIER('Table'[Date]))
),
[Stock]
)
Here I add this wrong measure and the expected values. Help me!
Date | Product | Stock | Expected Value (Wrong) | Exepected Value (right) |
02/05/2023 | A | 4 | 4 | |
02/05/2023 | B | 0 | 2 | |
02/05/2023 | C | 0 | 1 | |
01/05/2023 | A | 4 | 4 | |
01/05/2023 | B | 2 | 2 | 2 |
01/05/2023 | C | 1 | 1 | 1 |
30/04/2023 | A | 4 | 4 | |
30/04/2023 | B | 0 | 0 | |
30/04/2023 | C | 2 | 2 | 2 |
29/04/2023 | A | 4 | 4 | 4 |
29/04/2023 | B | 0 | 0 | 0 |
29/04/2023 | C | 0 | 1 | |
28/04/2023 | A | 5 | 5 | |
28/04/2023 | B | 1 | 1 | 1 |
28/04/2023 | C | 1 | 1 | 1 |
27/04/2023 | A | 5 | 5 | 5 |
27/04/2023 | B | 2 | 2 | 2 |
27/04/2023 | C | 0 | 0 | 0 |