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 / Filtering Gallery usin...
Power Apps
Answered

Filtering Gallery using numbers between or greater than

(0) ShareShare
ReportReport
Posted on by 213

Hello, I am trying to filter a gallery to show only items with the Status as "Full Solvent" or "Water Wipe", within the last 24 hours, where the text in label2_89 is greater than 2.5. 

 

Since Label 2_89 is within the first gallery and not a field in the source, I feel like I am going to have to use a second gallery to filter the first gallery. 

 

The first gallery is below as well as the formula I am using to filter it. 

 

Filter('StatusBoardData_HILLIARD_Rev2.0',Status = "Full Solvent" || Status = "Water Wipe" && Time >= DateAdd(Now(),-24,Hours))

JWPowder_1-1641919799010.png

 

 

Categories:
  • Drrickryp Profile Picture
    Super User 2024 Season 1 on at

    @JWPowder 

    Have  you tried using AddColumns() to add the value in the label to the gallery's source and then  filtering the resulting table by >2.5?

  • JWPowder Profile Picture
    213 on at

    @Drrickryp ,  below is the formula I am using in Label2_89:

    Abs(DateDiff(DateTimeValue(Label2_87.Text), DateTimeValue(Label2_88.Text), Minutes))/60

    Where would I include the AddColumns() function? 

  • Drrickryp Profile Picture
    Super User 2024 Season 1 on at

    @JWPowder 

    You will need to use the actual data from the datasource (obtained by using ThisItem.xxx) to generate the values you would use in the formula instead of the labels.  

  • JWPowder Profile Picture
    213 on at

    @Drrickryp , Okay, I added a calculated column in the sharepoint list that calculates the status duration now. 

     

    Not sure what is wrong in this formula but it is throwing an error. 

     

    Filter(AddColumns('StatusBoardData_HILLIARD_Rev2.0', Status, Status.Value , Time, Time.Value, 'End Time', 'End Time'.Value, 'Status Duration', 'Status Duration'.Value), Status = "Full Solvent" || Status = "Water Wipe" && Time >= DateAdd(Now(),-24,Hours))
  • Drrickryp Profile Picture
    Super User 2024 Season 1 on at

    @JWPowder 

    I would recommend that you do the calculation in PowerApps.  Calculated columns in SharePoint can be problematic.  Could you show the column names used in calculating the labels please and I will help to construct a formula for you to try.

  • JWPowder Profile Picture
    213 on at

    An there in lies the issue. I had the calculation in power apps but it would not let me filter the gallery to rule out values less than 2.5, if you look in my original message, the label2_89 contains the DateDiff calculation. 

  • JWPowder Profile Picture
    213 on at

    @Drrickryp  here are my columns. 

     

    JWPowder_0-1641927648450.png

     

  • Verified answer
    v-qiaqi@microsoft.com Profile Picture
    Microsoft Employee on at

    Hi @JWPowder,

    Let me make it easy for you:

    1). Please check how you set the Text property of the Label2_87 and Label2_88, copy the formula within both of the Labels

    2). Add a temporary column within the data source to save the calculation between the values from Label2_87 and Label2_88.

     

    Modify your formula as below:

    Filter(AddColumns('StatusBoardData_HILLIARD_Rev2.0',"CalculateDate",Abs(DateDiff(ThisItem.DateColumn1, ThisItem.DateColumn2, Minutes))/60),Status = "Full Solvent" || Status = "Water Wipe" && Time >= DateAdd(Now(),-24,Hours)&&CalculateDate>"2.5")

    Note that the ThisItem.DateColumn1 represents the formula you set for the Label2_87, ThisItem.DateColumn2 represents the formula you set for the Label2_88.

  • JWPowder Profile Picture
    213 on at

    @v-qiaqi-msft I am having trouble understanding and putting this into practice. 

     

    1. The formulas for the labels in my gallery were simply, thisItem.Time and thisItem.'End Time' as that was the name of the columns. 

    2. I am not sure what you mean by adding a temp column, I have a column already in my app that calculates the duration between the 2 columns that I can use. 

     

    I attempted to do what you stated above with the modified formula below but I am still getting errors. 

     

    Filter(AddColumns('StatusBoardData_HILLIARD_Rev2.0',"CalculateDate",Abs(DateDiff(ThisItem.Time, ThisItem.'End Time', Minutes))/60),Status = "Full Solvent" || Status = "Water Wipe" && Time >= DateAdd(Now(),-24,Hours)&&CalculateDate>"2.5")

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

#2
WarrenBelz Profile Picture

WarrenBelz 204 Most Valuable Professional

#3
Mohsin Ali Profile Picture

Mohsin Ali 122

Last 30 days Overall leaderboard