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

Count sharepoint items in date range

Hi,

In my Sharepoint list I've got column -Status (Active/Closed), ImplementDate (implementation date) and DueDateCurrent, which has expiration date. 

So I've got my DataTable which is connected to Sharepoint List. Now I want to create screen, let's called it StatisticScreen, put there 2 date pickers, and based on that time range I want to count how many records are "Active" in that time range. 

Any ideas?

 

//edit

Also, when I'll try that formula (*DueDateCurrent is a name of column in SPList):

CountRows(Filter(SPList, Status="Active" && DueDateCurrent >= DateAdd(Today(), -90)))

DueDateCurrent is underlined with that error -> "Invalid argument type. Expecting a Number value." 

In SPList, this column has type "Multiple lines of text".

1 ACCEPTED SOLUTION

Accepted Solutions
yashag2255
Dual Super User II
Dual Super User II

Hi @nottheOther 

 

Can you try to update the formula to:

CountRows(Filter(SPList, Status="Active", Value(Text(DueDateCurrent, "yyyymmdd")) >= Value(Text(DateAdd(Today(), -90), "yyyy-mm-dd"))))

Since you need number type values to compare, you need to convert the date to numbers in the format yyyymmdd.

 

Hope this Helps!

 

If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

View solution in original post

5 REPLIES 5
JesperHuang
Helper I
Helper I

Hi @nottheOther ,

 

Try this way?

CountRows(Filter(SPList, Status="Active", DueDateCurrent >= DateAdd(Today(), -90)))

 

v-monli-msft
Community Support
Community Support

Hi @nottheOther ,

 

The result for DateAdd function is a date/time value. But DueDateCurrent column is a Multiple lines of text column. So you cannot compare it with date value. You will need to change DueDateCurrent column to a date column to make it work.

 

Regards,

Mona

Community Support Team _ Mona Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hi @v-monli-msft ,

 

When I'm patching this column I use smth like this ->

 

DueDateCurrent:Text(DatePicker1_2.SelectedDate, "[$-en-GB]yyyy-mm-dd")})

 

 Is there a way to workaround this, without changing column type?

Hi @nottheOther ,

 

Try to use below formula instead:

CountRows(Filter(SPList, Status="Active", DueDateCurrent>= Text(DateAdd(Today(), -90), "[$-en-GB]yyyy-mm-dd")))

 

Regards,

Mona 

Community Support Team _ Mona Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
yashag2255
Dual Super User II
Dual Super User II

Hi @nottheOther 

 

Can you try to update the formula to:

CountRows(Filter(SPList, Status="Active", Value(Text(DueDateCurrent, "yyyymmdd")) >= Value(Text(DateAdd(Today(), -90), "yyyy-mm-dd"))))

Since you need number type values to compare, you need to convert the date to numbers in the format yyyymmdd.

 

Hope this Helps!

 

If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

View solution in original post

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

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

Power Apps June 2021

June Power Apps Community Call

Don't miss the call this month on June 16th - 8a PDT

Top Solution Authors
Top Kudoed Authors
Users online (66,071)