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 / Show last item of columns
Power Apps
Answered

Show last item of columns

(0) ShareShare
ReportReport
Posted on by 140

Hello all,

 

I'm developing an audit app and I need show the last score of each item (each column).

Something comes to mind, but I can't translate it into code.

 

For example, first question answer is 3 (3/5)..

Then when I create new form for new audit, I want to show these previous first question's answer beside score card (with label, or textbox doesn't matter). How can I do this? 

 

Thanks a lot in advance

 

Categories:
  • LaurensM Profile Picture
    12,516 Moderator on at

    @ernu if you want the last record of a table, you can use the Last() function:

     

    Last(DataSource).ColumnName


    If you want the last as in most recently entered record, try:

    First(Sort(DataSource, CreatedOnFieldName, Descending)).ColumnName

     


    Was this the functionality you were looking for?

  • ernu Profile Picture
    140 on at

    Thanks a lot!

    This is so useful for my task. But I want to ask one more question..

     

    I have a brand column and there are a lot brand in this column.

    How can I filter according to brand's column?

     

    For example; first question's answer of Nike is 3. but another brand is Puma's first question answer is 4..

    But my question and answer field is common. I need filter this.

  • LaurensM Profile Picture
    12,516 Moderator on at

    @ernu if the brand field is just a text field, try the following:

    Filter(DataSource, BrandFieldName = Label.Text)


    You can add this into the previously written code:

    First(Sort(Filter(DataSource, Brand = Label.Text), CreatedOnFieldName, Descending)).ColumnName

     
    In both cases you will a label, text input or dropdown field to select the brand you want.

    If this solves your question, would you be so kind as to accept it as a solution.
    Thanks!

  • ernu Profile Picture
    140 on at

    I'm writing all codes into the text of label (this label, which I want to show the previous audit response).

    I'm trying first solution but it doesn't work.

     

    By the way, brand column is comboBox.

     

    Filter('mySource', Label2.Text = DataCardValue8.Selected.Value) but it's wrong because already doesn't appear Text method of Label2. Already we're inside of Label2's text..

  • Verified answer
    LaurensM Profile Picture
    12,516 Moderator on at

    @ernu
    If you want to show Response1 in the Response1 label and the brand is filtered by a dropdown, you will have to add the following code:

    Label Text property:

    First(Sort(Filter(DataSource, BrandColumnName = DataCardValue8.Selected.Value), CreatedOnFieldName, Descending)).Response1ColumnName

    The label will now show the most recent value of Response1 column for that particular brand.

    Please also double check if the dropdown has the value you expect, by e.g. using this code in the Text property of a temporary label:

    DataCardValue8.Selected.Value

     
    I hope this helps!

  • ernu Profile Picture
    140 on at

    Thank you for your help.

    But I'm getting an error about 2nd parameter of "Sort"..

     

    First(Sort(Filter('myBrandSource', BrandColumn = DataCardValue8.Selected.Value), ?????, Descending)). ScoreColumn

     

    I couldn't understand what did you mean in your code with CreatedOnFieldName.

    By the way, my score column also ComboBox like Brand column.

     

    Example flow:

    (1) I selected Puma brand in the BrandColumn (cb_Brand, combobox)

    (2) I selected 4 scores in the ScoreColumn (cb_Score, combobox)

    (3) I submitted the form.

    (4) I opened a new form.

    (5) When I selected again brand and score, I need to see last score (4) in the label of score combobox (position bottom or top of cb_Score, doesn't matter.. already it's another object, lbl_LastScore)

  • LaurensM Profile Picture
    12,516 Moderator on at

    @ernu with CreatedOnFieldName I mean the field where the 'created on date' is saved.
    This default field is commonly name 'Created' or 'Created on', the sort would then show the most recently created record/score first.

  • ernu Profile Picture
    140 on at

    I got it! It was a little difficult but haha 🙂

    There was another error in the comparison section of filter command. but I solved it!

     

    Thank you so much for your support!

     

     

     

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 354 Super User 2026 Season 2

#2
M Bilal Khan Profile Picture

M Bilal Khan 320

#3
Mohsin Ali Profile Picture

Mohsin Ali 246

Last 30 days Overall leaderboard