cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Courtney
Helper V
Helper V

Power Apps Sharepoint filter

Hi Guys

 

Quick question... 


Is it possible to have powerapps view a SharePoint list but only specific columns of information?

 

Ideally, I would like to be able to filter the information and also have a colour change when an entry is close to being posted for 24 hours.

 

Any help would be much appreciated. 

13 REPLIES 13

I like @v-bofeng-msft's thinking, I'm thinking I would also wrap it up in a With function to make it easier to view and understand 🙂

 

Put this inside the label's Color property and let me know if that works for you, otherwise let us know if there's any issues when implementing it

With(
     { ThisDateDiff = DateDiff(
                               First(
                                     Sort(
                                          Filter(
                                                 YourDataSource,
                                                 Created < ThisItem.Created
                                          ),
                                          Created,
                                          Descending
                                     )
                               ).Created,
                               ThisItem.Created,
                               Hours
                      )
     },
     If(
        ThisDateDiff < 3, Red,
        ThisDateDiff < 12, Orange,
        ThisDateDiff < 24, Green
     )
)

 

After that we can look at filtering the gallery by the selected section,

 

Cheers,

Sancho

@iAm_ManCat


Please 'Mark as Solution' if someone's post answered your question and always 'Thumbs Up' the posts you like or that helped you!


Thanks!
You and everyone else in the community make it the awesome and welcoming place it is, keep your questions coming and make sure to 'like' anything that makes you 'Appy
Sancho Harker, MVP


Thank you for helping. The second part works fine but the first is giving me a few issues. I've tried adding my data source with the @ also and it doesn't seem to be working.

 

Here is a screenshot.

 

Screen.png

Ok, I've had another think about this,

 

I think comparing the creation date to Now() would work in the same way - that way each item is compared again the current moment in time:

 

With(
      // Here we have the date difference between NOW and when it was created
     { 
         ThisDateDiff: DateDiff(
                                ThisItem.Created,
                                Now(),
                                Hours
                      )
     },
     // If that difference is more than 21 hours (24-3) then red
     // This gets us anything with 0to3 hours left
     // If that difference is more than 12 hours (24-12) then green
     // This gets us anything 3to12 hours left
     // Otherwise that difference is less than or equal to 12, and green
     // This gets us anything that has 12to24 hours left
     If(
        ThisDateDiff > 21, Red,
        ThisDateDiff > 12, Orange,
        Green        
     )
)

 

 

Then you could filter the gallery to only show the last X items created or something like that..

 

I tested the above script and was able to format according to Date Created vs Time Right Now:
image.png

@iAm_ManCat


Please 'Mark as Solution' if someone's post answered your question and always 'Thumbs Up' the posts you like or that helped you!


Thanks!
You and everyone else in the community make it the awesome and welcoming place it is, keep your questions coming and make sure to 'like' anything that makes you 'Appy
Sancho Harker, MVP


View solution in original post

Works perfectly, thank you so much!

Helpful resources

Announcements
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

MBAS Attendee Badge

Claim Your Badge & Digital Swag!

Check out how to claim yours today!

secondImage

Are Your Ready?

Test your skills now with the Cloud Skill Challenge.

secondImage

Demo Extravaganza is Back!

We are excited to announce that Demo Extravaganza for 2021 has started!

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

Top Solution Authors
Top Kudoed Authors
Users online (63,644)