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!The Power BI Data Visualization World Championships is back! It's time to submit your entry. Live now!
I have got Calendar table (first one below, only first 3 rows as example) created in DAX.
Calendar =
ADDCOLUMNS(
CALENDARAUTO(),
"Year", YEAR ( [Date] ),
"Month", FORMAT ( [Date], "mmmm" ),
"Month Number", MONTH( [Date] )
)
and Maturity table (second one). They are related by Date/SampleDate (1-*).
I use a measure AAA to populate dates when there were some test results with associated Code. To this point it's ok.
AAA = IF(SELECTEDVALUE('Calendar'[Date]) = SELECTEDVALUE('Maturity'[SampleDate]), SELECTEDVALUE('Maturity'[Code]),"")
Goal
I have a table below, values are AAA measure as above. How to fill the days when there were no results in a way that it uses the Code from the previous test, until a new test is done? The ideal results shown in the picture below in red.
Attempts
AAA =
VAR SelectedDate = SELECTEDVALUE('Calendar'[Date])
VAR SampleCode =
CALCULATE(
SELECTEDVALUE('Maturity'[Code]),
ALLEXCEPT('Maturity', 'Maturity'[SampleDate], 'Maturity'[Grower], 'Maturity'[Orchard], 'Maturity'[ManagementArea]),
'Maturity'[SampleDate] <= SelectedDate,
'Maturity'[Code] <> BLANK()
)
VAR PreviousSample =
CALCULATE(
SELECTEDVALUE('Maturity'[SampleDate]),
ALLEXCEPT('Maturity', 'Maturity'[Grower], 'Maturity'[Orchard], 'Maturity'[ManagementArea]),
'Maturity'[SampleDate] < SelectedDate,
'Maturity'[Code] <> BLANK()
)
VAR NextSample =
CALCULATE(
SELECTEDVALUE('Maturity'[SampleDate]),
ALLEXCEPT('Maturity', 'Maturity'[Grower], 'Maturity'[Orchard], 'Maturity'[ManagementArea]),
'Maturity'[SampleDate] > SelectedDate,
'Maturity'[Code] <> BLANK()
)
RETURN
IF(
SampleCode <> BLANK(),
SampleCode,
IF(
SelectedDate > PreviousSample && SelectedDate < NextSample,
CALCULATE(
SELECTEDVALUE('Maturity'[Code]),
ALLEXCEPT('Maturity', 'Maturity'[SampleDate], 'Maturity'[Grower], 'Maturity'[Orchard], 'Maturity'[ManagementArea]),
'Maturity'[SampleDate] = PreviousSample,
'Maturity'[Code] <> BLANK()
),
BLANK()
)
)
To report on things that are not there you need to use disconnected tables and/or crossjoins
The Power BI Data Visualization World Championships is back! It's time to submit your entry.
Check out the January 2026 Power BI update to learn about new features.
| User | Count |
|---|---|
| 61 | |
| 41 | |
| 30 | |
| 26 | |
| 23 |
| User | Count |
|---|---|
| 132 | |
| 111 | |
| 57 | |
| 39 | |
| 35 |