Hi Mates,
I want to count the number of items in between selected dates from a SharePoint list. I have Created On date and time field standard date and time format.
I have tried with datepickers with below formula
CountIf('EUTSTSTS','Created On' >= DatePicker2_1.SelectedDate && 'Created On' <= DatePicker3_1.SelectedDate)
but it was not showing true count. please refer below screen for your idea.
Please help me to resolve it. Thanks!
You can try to use the Count around a filtered source. So you filter your datasource on the start-end date/time, and you count these rows.
CountRows(FilteredSource)
Set this code in the Text-property of a label, and you see the number of rows.
I had tried with below formula
CountRows(Filter('EUSTSTS','Created On'>= DatePicker2_1.SelectedDate && 'Created On' < DatePicker3_1.SelectedDate))
But same thing happened again. It was showing wrong count only
You can also set the formula in a Datatable, this way you see your filtered source. This way you can analyze, and edit your formula until you have the expected result.
If you need more help, please share some screenshots of the issue..
Hi @ShaikSayyad
Could you please check whether your PowerApp and the SP has the same time zone?
If not,please set them to same and then test again.
More information:
Best Regards.
Yumia
Hello @ShaikSayyad ,
Actually whatever condition you are using with ">=" or "<=" or "<" or ">" - this are delegable functions, using this data can be vary, it wont show you always the correct result.
You could see there, the function you have written there should be blue line and it will show you message of delegation.
Below is link for delegable function and more details:
https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/delegation-overview
For getting exact count of records you need to find a way which is not using any of the delegable functions/operators.
Thanks,
Milansinh Raj
See I'm not getting any delegable errors in my formula,please have a look into the below screen you would get what was the my issue.App screen
SharePoint List
Actually the true count was 74 in between selected dates but it was showing 54 only.
for your information my SP list has date and time format.
CountRows(Filter('EUSTSTS',DateValue(Text('Created On'))>= DatePicker2_1.SelectedDate && DateValue(Text('Created On')) < DatePicker3_1.SelectedDate))
As you said SP list have Date Time format, we have converted 'Created on' field to Date and then compared.
let me know after trying this formula.
CountRows(Filter('EUSTSTS',DateValue(Text('Created On'))>= DatePicker2_1.SelectedDate && DateValue(Text('Created On')) < DatePicker3_1.SelectedDate))
Not woring, I got the same result 54 items only.
can you display value on Text label of Selected dates ? So I can see what its taking from Date Control ?
User | Count |
---|---|
122 | |
87 | |
86 | |
75 | |
67 |
User | Count |
---|---|
214 | |
180 | |
137 | |
96 | |
83 |