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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Filter last non-blank ...
Power Apps
Unanswered

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:
I have the same question (0)
  • 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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 757 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 322 Super User 2025 Season 2

#3
MS.Ragavendar Profile Picture

MS.Ragavendar 209 Super User 2025 Season 2

Last 30 days Overall leaderboard