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 / Newbie help required
Power Apps
Answered

Newbie help required

(0) ShareShare
ReportReport
Posted on by 7

So, I'm trying to teach myself PowerApps from a variety of sources and seem to be failing at the first hurdle and would be appreciative of someones input so I can move on in my PowerApps travels.

I have set up, what should be, a very simple scenario to test the use of Global variables.

Simple screen, when I select "App" on the treeview, I select the "OnStart" property and declare two global variables:-

Set(LabelText,"");
Set(_CurrentWeekNo, RoundDown((RoundUp(Today()-Date(Year(Today()-Weekday(Today()-1)+4),1,3),0)+Weekday(Date(Year(Today()-Weekday(Today()-1)+4),1,3))+5)/7,0))   

 

The second declaration is meant to calculate the week number of the current date, I found the equation online, I'm not too bothered whether it gives the right answer at the moment, I'm simply trying to actually use the variable in a screen.

 

In Screen1 I then have 3 items:-

LabelHello, simple label, only property set is the text property which is set to the variable LabelText

Button1: onselect property set to  Set(LabelText,Text(_CurrentWeekNo,"[$-en-GB]0"))

Button2: onselect property set to  Set(LabelText,"")

 

The idea is when the app is run, the label should start blank then if I click Button1, the label text should display the week number, if I click button2, the text should clear.

 

As I said, should be easy, it's just not working ie button1 doesn't display the current week number.

 

Any help / guidance anyone can provide would be really welcome.


Thanks in advance

Categories:
I have the same question (0)
  • Verified answer
    timl Profile Picture
    36,815 Super User 2026 Season 1 on at

    Hi @davec1 

    It's quite possible that your _CurrentWeekNo variable isn't set. This will explain why nothing happens when you click Button1.

    To confirm if this is the case, what happens if you were to set the text property of a label to _CurrentWeekNo? Do you see the correct week number? If not, you should run your OnStart formula using the menu item in the context menu.

     

    timl_0-1605116516009.png

     

  • davec1 Profile Picture
    7 on at

    @timl1, thanks very much for your quick response. I tried running the OnStart formula from the context menu and that works now, thank you.

     

    As a newbie, is this just something to look out for when dealing with variables in PowerApps or is there a specific reason it wouldn't work without doing this ?

     

    Many thanks again, much appreciated

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the March Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
Vish WR Profile Picture

Vish WR 914

#2
11manish Profile Picture

11manish 627

#3
Valantis Profile Picture

Valantis 598

Last 30 days Overall leaderboard