Skip to main content

Notifications

Power Apps - Building Power Apps
Answered

How to filter a text label similar to how a gallery is filtered

(0) ShareShare
ReportReport
Posted on by 101

Hello,

So I am already pretty far down the line with this app. One of the functions I have set up is to only display the items created by the user logged in. So basically, I have a hidden text label that is set to User().FullName using Office365 connections. From there, I connect this to our employee database to pull job titles, departments, etc. Anyways, filtering my gallery is relatively easy. I have a few extra components that include filters and variables so please ignore those, what I am referrring to is in red.

Filter('Expense Records', SubmittedBy = EmployeeID.Text, Or(varFilter ="All", Status = varFilter))

Basically says that when a form is submitted ^, see if the hidden label on the main page matches the submitted code saved by the form and then display only these values. Simple right?

Well, at the top of my page I want a summary, that lets a user view the counts and totals of their expenses. Here is the function for the Pending one, the only differences are the statuses in "" for the others.

"$ " & Round(If(Sum(Filter('Expense Records', Status = "Pending"), Amount) = Blank(), Blank(), "$ " & Sum(Filter('Expense Records', Status = "Pending"), Amount)), 2)

What I am having trouble with is incorporating the Filter(Source, ID = ID.text) type logic into this already long formula. Right now, these totals sum EVERYONEs expense, but I just want it to pull in the amounts from the user currently logged in, similar to my gallery.

Thanks!

Categories:
  • water-guy-5 Profile Picture
    water-guy-5 101 on at
    Re: How to filter a text label similar to how a gallery is filtered

    @WarrenBelz whoops sorry about that. I was getting confused by the wItem part of the message you sent

  • WarrenBelz Profile Picture
    WarrenBelz 145,495 on at
    Re: How to filter a text label similar to how a gallery is filtered

    HI @water-guy-5 ,

    If you have a look at what I posted, it is exactly the same, but you do not have to type in the filter twice.

  • Verified answer
    water-guy-5 Profile Picture
    water-guy-5 101 on at
    Re: How to filter a text label similar to how a gallery is filtered

    Hey everyone, I figured it out. Turns out it was a lot easier than expected. I was trying to incorporate an AND function to my IF, but I instead just added "&&" with another parameter

    "$ " & Round(If(Sum(Filter('Expense Records', Status = "Pending"), Amount) = Blank(), Blank(), "$ " & Sum(Filter('Expense Records', Status = "Pending"), Amount)), 2)

    with the change is

    "$ " & Round(If(Sum(Filter('Expense Records', Status = "Pending" && SubmittedBy = EmployeeID.Text), Amount) = Blank(), Blank(), "$ " & Sum(Filter('Expense Records', Status = "Pending" && SubmittedBy = EmployeeID.Text), Amount)), 2)

  • Verified answer
    WarrenBelz Profile Picture
    WarrenBelz 145,495 on at
    Re: How to filter a text label similar to how a gallery is filtered

    Hi @water-guy-5 ,

    Maybe something like this

    With(
     {
     wItem:
     Filter(
     'Expense Records', 
     Status = "Pending" &&
     SubmittedBy = EmployeeID.Text
     )
     },
     Coalesce(
     wItem,
     "$" & 
     Round(
     Sum(
     wItem,
     Amount
     ),
     2
     )
     )
    ) 

     

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

    Visit my blog Practical Power Apps

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

Microsoft Kickstarter Events…

Register for Microsoft Kickstarter Events…

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Announcing Forum Attachment Improvements!

We're excited to announce that attachments for replies in forums and improved…

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 145,495

#2
RandyHayes Profile Picture

RandyHayes 76,287

#3
Pstork1 Profile Picture

Pstork1 64,822

Leaderboard