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 / Calculate zipcode rang...
Power Apps
Answered

Calculate zipcode ranges available

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

Hi guys,

 

I am making an app where admins can enter postcoderanges between 1000-9999. To make it easy for them i would like to show them which ranges are still available. 

In the screenshot below you can see there is a range available between 2531 and 2599. This is the only range that is still available between 1000-9999. 

 

AnthonyDo_0-1630655147332.png

How would i be able to display it like this:

 

Available zip ranges:

  • 2531 - 2599

 

The datasource "Custom Entity [dbo].[PostcodeRange]" looks like this:
(There are duplicates because companies are related to the ranges)

AnthonyDo_1-1630655312678.png

 

I would need some kind of forall loop that checks for available ranges between start and end zip codes.

 

Best Regards,

Anthony

 

Categories:
  • JR-BejeweledOne Profile Picture
    5,836 Moderator on at

    How do you determine if a range is available? 

  • Verified answer
    v-xiaochen-msft Profile Picture
    Microsoft Employee on at

    Hi @AnthonyDo ,

     

    I did a test for you.

    vxiaochenmsft_0-1631246291614.png

    I assume the range is 1-20.

     

    Add a button control and set its onselect property to:

    ClearCollect(Col,{Value:1});Clear(Col);ForAll(LIST168 As A,If(CountRows(Filter(ForAll(LIST168 As B,If(A.PostcodeStart>B.PostcodeStart&&A.PostcodeStart<B.PostcodeEinde,{Value2:1})),!IsBlank(Value2)))=0,Collect(Col,{Value:A.PostcodeStart})));ForAll(LIST168 As A,If(CountRows(Filter(ForAll(LIST168 As B,If(A.PostcodeEinde>B.PostcodeStart&&A.PostcodeEinde<B.PostcodeEinde,{Value2:1})),!IsBlank(Value2)))=0,Collect(Col,{Value:A.PostcodeEinde})))

     

    Add a combo box control and set its Items property to:

    SortByColumns(Distinct(Col,Value),"Result")

     

    The result is as follows:

    vxiaochenmsft_1-1631246410450.png

     

    Best Regards,

    Wearsky

     

     

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

#2
M Bilal Khan Profile Picture

M Bilal Khan 271

#3
Mohsin Ali Profile Picture

Mohsin Ali 239

Last 30 days Overall leaderboard