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 gallery by numb...
Power Apps
Answered

filter gallery by number range

(0) ShareShare
ReportReport
Posted on by 122

I wanted to filter Price by range so I tried using this but it crashed:

6.png

My code of Items in Gallery:

 

 

With( {ctxRange:ComboBox5.Selected.range},
Sort(
 Filter(
 Product,
 If(
 CountRows(ctxRange)>1,
 Price>Index(ctxRange,1).Value&&Price<=Index(ctxRange,2).Value,
 Price>=Index(ctxRange,1).Value
 ),
 StartsWith(
 Title,
 tbSearchProduct.Text
 ) || StartsWith(
 Manufacturer,
 tbSearchProduct.Text
 ),
 (Manufacturer = cmb_ManuShopping.Selected.Value || cmb_ManuShopping.Selected.Value = Blank()) && (Category = cmb_CateShopping.Selected.Value || cmb_CateShopping.Selected.Value = Blank()) && (ShoeHeight.Value = cmb_ShoeHeight.Selected.Value || cmb_ShoeHeight.Selected.Value = Blank())
 ),
 Price,
 If(
 ComboBox2.Selected.Value = "Low-High",
 SortOrder.Ascending,
 SortOrder.Descending
 )
))

 

 

Is there a way to fix that warning?

I hope everyone can help. Thank you.

 

 

Categories:
  • Verified answer
    v-bofeng-msft Profile Picture
    Microsoft Employee on at

    Hi @Edward00 ,

     

    Please try:

    With( 
    {ctxRange:ComboBox5.Selected.range},
    With(
    {
    countRowsctxRange:CountRows(ctxRange),
    ctxRange1:Index(ctxRange,1).Value
    ctxRange2:Last(ctxRange).Value
    },
    Sort(
     Filter(
     Product,
     If(
     countRowsctxRange>1,
     Price>ctxRange1&&Price<=ctxRange2,
     Price>=ctxRange1
     ),
     StartsWith(
     Title,
     tbSearchProduct.Text
     ) || StartsWith(
     Manufacturer,
     tbSearchProduct.Text
     ),
     (Manufacturer = cmb_ManuShopping.Selected.Value || cmb_ManuShopping.Selected.Value = Blank()) && (Category = cmb_CateShopping.Selected.Value || cmb_CateShopping.Selected.Value = Blank()) && (ShoeHeight.Value = cmb_ShoeHeight.Selected.Value || cmb_ShoeHeight.Selected.Value = Blank())
     ),
     Price,
     If(
     ComboBox2.Selected.Value = "Low-High",
     SortOrder.Ascending,
     SortOrder.Descending
     )
    )
    ))

     

    Best Regards,

    Bof

  • Edward00 Profile Picture
    122 on at

    Hi @v-bofeng-msft 

    It's still being warned.

    Edward00_0-1691544483886.png

     

  • v-bofeng-msft Profile Picture
    Microsoft Employee on at

    Hi @Edward00 ,

     

    Maybe you could try:

    With( 
    {ctxRange:ComboBox5.Selected.range},
    With(
    {
    countRowsctxRange:CountRows(ctxRange),
    ctxRange1:Index(ctxRange,1).Value
    ctxRange2:Last(ctxRange).Value
    },
    Sort(
    If(
     countRowsctxRange>1, 
     Filter(
     Product,
     Price>ctxRange1&&Price<=ctxRange2,
     StartsWith(
     Title,
     tbSearchProduct.Text
     ) || StartsWith(
     Manufacturer,
     tbSearchProduct.Text
     ),
     (Manufacturer = cmb_ManuShopping.Selected.Value || cmb_ManuShopping.Selected.Value = Blank()) && (Category = cmb_CateShopping.Selected.Value || cmb_CateShopping.Selected.Value = Blank()) && (ShoeHeight.Value = cmb_ShoeHeight.Selected.Value || cmb_ShoeHeight.Selected.Value = Blank())
     ),
     Filter(
     Product,
     Price>=ctxRange1,
     StartsWith(
     Title,
     tbSearchProduct.Text
     ) || StartsWith(
     Manufacturer,
     tbSearchProduct.Text
     ),
     (Manufacturer = cmb_ManuShopping.Selected.Value || cmb_ManuShopping.Selected.Value = Blank()) && (Category = cmb_CateShopping.Selected.Value || cmb_CateShopping.Selected.Value = Blank()) && (ShoeHeight.Value = cmb_ShoeHeight.Selected.Value || cmb_ShoeHeight.Selected.Value = Blank())
     )
    ),
     Price,
     If(
     ComboBox2.Selected.Value = "Low-High",
     SortOrder.Ascending,
     SortOrder.Descending
     )
    )))

    In addition, if your data source is sql sever ,then >,>=,<,<= is not delegable for DateTime column.

    vbofengmsft_0-1691545338383.png

     

    Best Regards,

    Bof

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