Forum Discussion

Asmonk's avatar
Asmonk
New Member
2 years ago
Solved

Fill blank values with last not blank value based with calculated column

Hello!
I have a table with multiple products and duplicated dates where I need to show the last registered price. To give an example this is how my table looks like:

Date

ProductPrice
12-31-2023A1
12-31-2023B2
01-01-2024A 
01-01-2024B 
01-02-2024A3
01-02-2024B5
01-03-2024A 
01-03-2024B6


And here is my desired result:

Date

ProductPrice
12-31-2023A1
12-31-2023B2
01-01-2024A1
01-01-2024B2
01-02-2024A3
01-02-2024B5
01-03-2024A3
01-03-2024B6

Thank you for any advice πŸ™‚

  • Asmonk 

    output : 

    Column = 
    var ds = 
    TOPN(1,
    FILTER(
        'Table',
        'Table'[Product.1] = EARLIER('Table'[Product.1]) && not ISBLANK('Table'[Price]) &&  'Table'[date]<=EARLIER('Table'[date])
    ),
    'Table'[date],DESC)
    
    
    return SELECTCOLUMNS(ds,'Table'[Price])

     

     

    let me know if this helps .

     

     

     

    If my answer helped sort things out for you, i would appreciate a thumbs up πŸ‘ and mark it as the solution βœ…
    It makes a difference and might help someone else too. Thanks for spreading the good vibes! 🀠 

2 Replies

  • Daniel29195's avatar
    Daniel29195
    Icon for Community Champion rankCommunity Champion

    Asmonk 

    output : 

    Column = 
    var ds = 
    TOPN(1,
    FILTER(
        'Table',
        'Table'[Product.1] = EARLIER('Table'[Product.1]) && not ISBLANK('Table'[Price]) &&  'Table'[date]<=EARLIER('Table'[date])
    ),
    'Table'[date],DESC)
    
    
    return SELECTCOLUMNS(ds,'Table'[Price])

     

     

    let me know if this helps .

     

     

     

    If my answer helped sort things out for you, i would appreciate a thumbs up πŸ‘ and mark it as the solution βœ…
    It makes a difference and might help someone else too. Thanks for spreading the good vibes! 🀠 

  • Greg_Deckler's avatar
    Greg_Deckler
    Icon for Community Champion rankCommunity Champion

    Asmonk Try:

    New Column = 
      IF( 
        [Price] <> BLANK(), 
        [Price],
          VAR __Date = [Date]
          VAR __Product = [Product]
          VAR __Last = MAXX( FILTER( 'Table', [Product] = __Product && [Date] < __Date && [Price] <> BLANK() ), [Price] )
        RETURN
          __Last
      )