cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
gilbkyle
Frequent Visitor

See last week's audit results based on WeekNum

I have a datasource that lists all historical audits.  It includes a "Week" column which is calculated based on the date of the audit using WeekNum() function.  I would like to be able to display a form showing last week's audits.  I thought I could do it with a Filter(mydatasource, Week = [WeekNum() - 1]) but that isn't doing it.  Does anyone have a suggestion?

1 ACCEPTED SOLUTION

Accepted Solutions

 @gilbkyle ,

You can use the Value function to convert a string / text to a number. 

Value function in Power Apps - Power Apps | Microsoft Docs

 

You can try it like this: Filter(mydatasource, Value(Week) = (WeekNum(Today()) - 1))

 

 

View solution in original post

4 REPLIES 4
mate_toth
Resolver I
Resolver I

Hi @gilbkyle,

 

WeekNum() doesn't give you the week number without a DateTime value as per the documentation. 

WeekNum and ISOWeekNum functions in Power Apps - Power Apps | Microsoft Docs

 

Please try with Filter(mydatasource, Week = (WeekNum(Today()) - 1))

 

 

Well that seems obvious now that it's pointed out 😄 Thanks.  

Now I'm getting a new error:  there's a blue line under the "=" sign in the filter as you have it written above.  When I mouse over, it says "Incompatible data types.  These types can't be compared: Text, Number".  I have the "Week" column formatted as a number.  I tried changing it to text and I get the same error.  Any guesses?

 @gilbkyle ,

You can use the Value function to convert a string / text to a number. 

Value function in Power Apps - Power Apps | Microsoft Docs

 

You can try it like this: Filter(mydatasource, Value(Week) = (WeekNum(Today()) - 1))

 

 

View solution in original post

@mate_toth - solved!

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.

Top Solution Authors
Top Kudoed Authors
Users online (2,796)