web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id : t/6+oGr9HasvKWKgW/HSgT
Power Apps - Building Power Apps
Answered

Creating a rotating notification bar

Like (0) ShareShare
ReportReport
Posted on 26 Sep 2023 05:10:35 by 7

Hi,

 

I'm trying to build a rotating notification bar in PowerApps which will show notifications / announcements based on start and stop date set in a SharePoint list.

 

This is my current setup:

SharePoint List -

Name: NotificationBar

Columns: Title, StartDate, EndDate


PowerApps -

Screen OnVisibleProperty:
ClearCollect(
FilteredNotifications,
Filter(
NotificationBar,
DateValue(StartDate) <= Today() && DateValue(EndDate) >= Today()
)
);

Label: 
If(
CountRows(FilteredNotifications) > 0,
LookUp(
Filter(
FilteredNotifications,
DateValue(StartDate) <= Today() && DateValue(EndDate) >= Today()
),
ID = Mod(CurrentNotification, CountRows(FilteredNotifications)) + 1
).Title,
""
)

Timer with OnTimerEnd Property:
If(
CountRows(FilteredNotifications) > 0,
UpdateContext({ CurrentNotification: Mod(CurrentNotification + 1, CountRows(FilteredNotifications)) }),
UpdateContext({ CurrentNotification: 1 })
)

This is working, but the problem is i have 6 items in my SharePoint list. It shows the first 4 and the 5th is blank. then it starts back from item 1.

5th Item is future dated. 6th item is current Dated.

 

My end goal is to show notifications one at a time based in the start and end date.


Any help / guidance is appreciated.

  • Sarananthan Profile Picture
    7 on 26 Sep 2023 at 10:10:25
    Re: Creating a rotating notification bar

    Thanks @v-jefferni. This solved the problem.

  • Verified answer
    v-jefferni Profile Picture
    on 26 Sep 2023 at 07:55:55
    Re: Creating a rotating notification bar

    Hi @Sarananthan ,

     

    Looking into the formula on the Label:

    If(
    CountRows(FilteredNotifications) > 0,
    LookUp(
    Filter(
    FilteredNotifications,
    DateValue(StartDate) <= Today() && DateValue(EndDate) >= Today()
    ),
    ID = Mod(CurrentNotification, CountRows(FilteredNotifications)) + 1
    ).Title,
    ""
    )

     

    For today 9/26/2023, items of ID 1-4 and 6 will be filtered and saved in the collection, so CountRows(FilteredNotifications) = 5, and while CurrentNotification = 4, Mod(4,5) = 4 so the criteria ID = 5 will get nothing from the collection. Then the next, Mod(5,5) = 0 so the next one is ID =1

     

    I think you should not use LookUp function to get an item with specific ID but use

    Last(FirstN(Filter(
    FilteredNotifications,
    DateValue(StartDate) <= Today() && DateValue(EndDate) >= Today()
    ), Mod(CurrentNotification, CountRows(FilteredNotifications)) + 1))

     

    it will get the fifth item in the collection because Mod(4,5) +1 = 5, and the first/only one item in the collection because Mod(5,5) +1 = 1

     

    Best regards,

  • Sarananthan Profile Picture
    7 on 26 Sep 2023 at 07:40:08
    Re: Creating a rotating notification bar

    Hi @v-jefferni , please find the data source screenshot.

  • v-jefferni Profile Picture
    on 26 Sep 2023 at 06:42:58
    Re: Creating a rotating notification bar

    Hi @Sarananthan ,

     

    Could you please share the list data as an example? I really cannot understand the data source and how it's used in your App according to the formulas you provided.

     

    Best regards,

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

Telen Wang – Community Spotlight

We are honored to recognize Telen Wang as our August 2025 Community…

Announcing our 2025 Season 2 Super Users!

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

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 637 Most Valuable Professional

#2
stampcoin Profile Picture

stampcoin 570 Super User 2025 Season 2

#3
Power Apps 1919 Profile Picture

Power Apps 1919 473

Loading complete