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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Filter last non-blank ...
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

 

Categories:
  • Verified answer
    gcmfaizan Profile Picture
    1,022 on at

    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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 360 Super User 2026 Season 2

#2
M Bilal Khan Profile Picture

M Bilal Khan 325

#3
Mohsin Ali Profile Picture

Mohsin Ali 232

Last 30 days Overall leaderboard