web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Power Apps - Building Power Apps
Answered

Filter last non-blank value in a collection

(1) ShareShare
ReportReport
Posted on by

Hi, I have a following SharePoint list with a lot of columns, and sometimes it looks like this:

 

plona95_0-1692621066107.png

 

I would like to load the last non-empty record as a default input for a text input field, so for 'motor cable size' it would be '1' (not blank).

 

Currently I use a code like this:

 

Spoiler (Highlight to read)
If(
!IsBlank(First(Filter(COLSavedDAM, Site = CurrentSite, 'MCC Name' = CurrentMCC,!IsBlank( CurrentMCC), 'Asset Name' = First(colAssetDetails).'Common Name' )).'Starter Mains Power Cabling Cable Size'),
First(Filter(COLSavedDAM , Site = CurrentSite, 'MCC Name' = CurrentMCC,!IsBlank( CurrentMCC), 'Asset Name' = First(colAssetDetails).'Common Name' )).'Starter Mains Power Cabling Cable Size'
,
"")
If(!IsBlank(First(Filter(COLSavedDAM, Site = CurrentSite, 'MCC Name' = CurrentMCC,!IsBlank( CurrentMCC), 'Asset Name' = First(colAssetDetails).'Common Name' )).'Starter Mains Power Cabling Cable Size'),First(Filter(COLSavedDAM , Site = CurrentSite, 'MCC Name' = CurrentMCC,!IsBlank( CurrentMCC), 'Asset Name' = First(colAssetDetails).'Common Name' )).'Starter Mains Power Cabling Cable Size',"")


I know that I could rewrite the code and use !IsBlank for Cabling Cable size etc., but I have 100s of text inputs like this and I don't want to rewrite a code for all, it would be great to find a solution that I can find&replace. I tried Coalesce() but I don't know how to focus it on one column. Any ideas? Thank you

 

I have the same question (0)
  • Verified answer
    gcmfaizan Profile Picture
    1,022 on at
    Re: Filter last non-blank value in a collection

    Hi @plona95 

    please try this forlmula I hope it helps you:

    Coalesce(
     LookUp(
     Filter(
     COLSavedDAM,
     Site = CurrentSite,
     'MCC Name' = CurrentMCC,
     !IsBlank(CurrentMCC),
     'Asset Name' = First(colAssetDetails).'Common Name',
     !IsBlank('Starter Mains Power Cabling Cable Size')
     ),
     true,
     'Starter Mains Power Cabling Cable Size',
     Descending
     ),
     ""
    )

    The Coalesce() function returns the first non-blank value from a list of arguments.

     

     

    If this is the answer for your question, please mark the post as Solved.
    If this answer helps you in any way, please give it a like.

     

    Thanks!

     

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Chiara Carbone – Community Spotlight

We are honored to recognize Chiara Carbone as our Community Spotlight for November…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 671 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 424 Super User 2025 Season 2

#3
developerAJ Profile Picture

developerAJ 243

Last 30 days Overall leaderboard