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

Finding start date of the week

Am building time registration app. I have a gallery which filters data according to uke number. From the gallery i want to find starting date of the week and ending date of the week. 

 

I have used below formulas to find it.

StartDate: 

Weekday(Gallery_UkeSkjema.Selected.Dato,StartOfWeek.Monday),Days),"[$-en-US]dd/mm/yyy")

Enddate:
Text(DateAdd(Gallery_UkeSkjema.Selected.Dato, 7 - Weekday(Gallery_UkeSkjema.Selected.Dato, Monday), Days),"[$-en-US]dd/mm/yyy")

 

Note: 
same formula working in test app. Don't know why it is not working in current app

1 ACCEPTED SOLUTION

Accepted Solutions

@PapithaSekar1 

Just to troubleshoot and make sure you are getting values for this formula, try the following changes:

 

1) Test against date value

Text(
    Gallery_UkeSkjema.Selected.Dato, 
    "dd/mm/yyyy"
)

 

2) Test weekday value

Weekday(Gallery_UkeSkjema.Selected.Dato, StartOfWeek.MondayZero)

 

3) Test "raw" date

DateAdd(
        Gallery_UkeSkjema.Selected.Dato, 
        -Weekday(Gallery_UkeSkjema.Selected.Dato, StartOfWeek.MondayZero), 
        Days
    )

 

And final most important question...is Dato an actual date type column? 

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up. Solved your problem? - Click on Accept as Solution. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too!

View solution in original post

3 REPLIES 3
Super User III
Super User III

@PapithaSekar1 

Please consider changing your Formula to the following:

Text(
    DateAdd(
        Gallery_UkeSkjema.Selected.Dato, 
        -Weekday(Gallery_UkeSkjema.Selected.Dato, StartOfWeek.MondayZero), 
        Days
    ),
    "dd/mm/yyyy"
)

 

Weekday returns a number, not a date.  You can use that then to add to an existing date.

 

I hope this is helpful for you.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up. Solved your problem? - Click on Accept as Solution. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too!

Thank you for your reply. 

 

I used the mentioned formula in a label control. its not returning any values.

@PapithaSekar1 

Just to troubleshoot and make sure you are getting values for this formula, try the following changes:

 

1) Test against date value

Text(
    Gallery_UkeSkjema.Selected.Dato, 
    "dd/mm/yyyy"
)

 

2) Test weekday value

Weekday(Gallery_UkeSkjema.Selected.Dato, StartOfWeek.MondayZero)

 

3) Test "raw" date

DateAdd(
        Gallery_UkeSkjema.Selected.Dato, 
        -Weekday(Gallery_UkeSkjema.Selected.Dato, StartOfWeek.MondayZero), 
        Days
    )

 

And final most important question...is Dato an actual date type column? 

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up. Solved your problem? - Click on Accept as Solution. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too!

View solution in original post

Helpful resources

Announcements
News & Announcements

Community Blog

Stay up tp date on the latest blogs and activities in the community News & Announcements.

Power Apps Community Call

Power Apps Community Call- January

Mark your calendars and join us for the next Power Apps Community Call on January 20th, 8a PST

PP Bootcamp Carousel

Global Power Platform Bootcamp

Dive into the Power Platform stack with hands-on sessions and labs, virtually delivered to you by experts and community leaders.

secondImage

Power Platform Community Conference On Demand

Watch Nick Doelman's session from the 2020 Power Platform Community Conference on demand!

Top Solution Authors
Top Kudoed Authors
Users online (3,468)