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

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.

Reply
Anonymous
Not applicable

Fill in blank value with most resent value and reset at the new year.

I am looking to fill in blank values with the most recent values that resets to 0 after the new year. This worked last year because the data only had 2023 in it. Now the data goes until the end of 2024... You can see that in 2023 the YTD Count works correctly, taking the values found and missing in the Lookup row and filling them in. All looks well in this example because there just so happens to be a value for YearMonth 2024-1 in Lookup (2). In the case where that value is subsequently 0 my dilemna arises. it will pull the most recent value from 2023-9 of 15. I want that to reset at 2024-1 to be 0. 

 

The formula i have so far (works for a single year but doesnt work in the case of more than 1 year): 

YTD_Count =
IF('Whs Part Month'[Lookup] = BLANK(),
    VAR _whspart = 'Whs Part Month'[Whs and Part]
    VAR _date = 'Whs Part Month'[Date]
    VAR _filter = FILTER('Whs Part Month', 'Whs Part Month'[Whs and Part] = _whspart && 'Whs Part Month'[Date] <= _date && 'Whs Part Month'[Lookup] <> BLANK() )
    VAR _maxdate = MAXX(_filter, 'Whs Part Month'[Date])
    RETURN
    MAXX(FILTER(_filter, [Date] = _maxdate && [Whs and Part] = _whspart), [Lookup]), 'Whs Part Month'[Lookup])
 
 
 
I think the problem is the MAXX function not enabling the anual reset... help appreciated! 
 
pbi.png

 

1 ACCEPTED SOLUTION
Fowmy
Super User
Super User

@Anonymous 

Use this calculated column:

YTD Count = 
  VAR _whspart = 'Whs Part Month'[Whs and Part]
  VAR _date = 'Whs Part Month'[Date]
  VAR _year = YEAR('Whs Part Month'[Date])
  VAR _T1 = 
      FILTER(
             'Whs Part Month',
             'Whs Part Month'[Whs and Part] = _whspart && 
             'Whs Part Month'[Date] <= _date &&
             'Whs Part Month'[Lookup] <> BLANK() &&
             YEAR( 'Whs Part Month'[Date] ) = _year

        )
  VAR _DateLast = MAXX( _T1 ,  'Whs Part Month'[Date] )
  VAR _result = MAXX(  FILTER( _T1  , 'Whs Part Month'[Date] =  _DateLast ) , 'Whs Part Month'[Lookup] )    
    RETURN
        COALESCE(_result,0)   

Fowmy_0-1705687651250.png


Scenario with no value to start 2024.

Fowmy_1-1705687813777.png

 

 



Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

View solution in original post

1 REPLY 1
Fowmy
Super User
Super User

@Anonymous 

Use this calculated column:

YTD Count = 
  VAR _whspart = 'Whs Part Month'[Whs and Part]
  VAR _date = 'Whs Part Month'[Date]
  VAR _year = YEAR('Whs Part Month'[Date])
  VAR _T1 = 
      FILTER(
             'Whs Part Month',
             'Whs Part Month'[Whs and Part] = _whspart && 
             'Whs Part Month'[Date] <= _date &&
             'Whs Part Month'[Lookup] <> BLANK() &&
             YEAR( 'Whs Part Month'[Date] ) = _year

        )
  VAR _DateLast = MAXX( _T1 ,  'Whs Part Month'[Date] )
  VAR _result = MAXX(  FILTER( _T1  , 'Whs Part Month'[Date] =  _DateLast ) , 'Whs Part Month'[Lookup] )    
    RETURN
        COALESCE(_result,0)   

Fowmy_0-1705687651250.png


Scenario with no value to start 2024.

Fowmy_1-1705687813777.png

 

 



Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

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.