Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply

Filling the table with missing dates with the last known value

Hello.
I have a problem with a way to create a measure that will allow me to fill in missing data dates with the last known values.

 

DateAverage

01/09/20220
01/10/20220
01/11/20220
01/12/202214.15
01/02/202334.84
01/03/202318.07
01/04/202338.39
01/05/2023142.42

 

This is my orginal Data, with original Date and Average column. As You see there are missing months:


01/01/2023
01/06/2023

01/07/2023

01/08/2023
 

In my report I have calendar tabel with all the required dates:

 

01/09/2022
01/10/2022
01/11/2022
01/12/2022
01/01/2023
01/02/2023
01/03/2023
01/04/2023
01/05/2023
01/06/2023
01/07/2023
01/08/2023

 

and my goal is to have this result:

 

DateAverage

01/09/20220
01/10/20220
01/11/20220
01/12/202214.15
01/01/202314.15
01/02/202334.84
01/03/202318.07
01/04/202338.39
01/05/2023142.42
01/06/2023142.42
01/07/2023142.42
01/08/2023142.42


of course this data range will be changing every month.
Today is:
from 09/2022 to 08/2023, next month will be from 10/2022 to 09/2023 etc etc.

Can You support me how to create a correct metric to calculate this.

Regards Piotr.

1 REPLY 1
barritown
Super User
Super User

Hi @piotrgrendus87,

Assuming that your Data and Calendar tables are not related, I can propose such a measure:

barritown_0-1696243005734.png

 

In plain text:

Value = 
VAR CurrentDate = MIN ('Calendar'[Date] )
VAR ExistingDate = MAXX ( FILTER ( Data, [Date] <= CurrentDate ), [Date] )
RETURN MAXX ( FILTER ( Data, [Date] = ExistingDate ), [Average] )

Best Regards,

Alexander

My YouTube vlog in English

My YouTube vlog in Russian

 

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.