Hello,
I have been trying different formulas without success if I want to Filter by a date range. The Sum function with my currency field without date as a criteria works fine even though I get the delegation warning.
I looked around the forum and tried a few things but no sucess.
My Goal: Sum up the 'Amount' column from my List called 'MaintenanceExpenses' for a specified date range based on 'ExpenseDatePickerFrom' and 'ExpenseDatePickerTo'. The date picker compare the date with my 'Created' column.
I have a SharePoint List with a column 'Amount' that is of Currency type.
My App and formula:
Text(Sum(Filter(MaintenanceExpenses,Value(Text(Created,"[$-en-US]mm/dd/yyyy")) >= ExpenseDatePickerFrom.SelectedDate,Value(Text(Created,"[$-en-US]mm/dd/yyyy")) <= ExpenseDatePickerTo.SelectedDate),Amount),"[$-en-US]$#,###0.00")
Most likely I'm making a very basic mistake. Any suggestion would be amazing!
Thanks!
Solved! Go to Solution.
Can you replace the filter criteria with something like this?
DateDiff(ExpenseDatePickerFrom.SelectedDate, Created)>0, DateDiff(Created, ExpenseDatePickerTo.SelectedDate)>0
Let me know if this helps.
---
If you like this reply, please give kudos (Thumbs Up). And if this solves your problem, please mark this reply as a solution by selecting Accept as Solution. This makes it easier for others to find answers to similar questions.
Thanks!
Hardit Bhatia
Microsoft Business Applications MVP
Blog | Twitter | LinkedIn | Facebook | YouTube | Email
Can you replace the filter criteria with something like this?
DateDiff(ExpenseDatePickerFrom.SelectedDate, Created)>0, DateDiff(Created, ExpenseDatePickerTo.SelectedDate)>0
Let me know if this helps.
---
If you like this reply, please give kudos (Thumbs Up). And if this solves your problem, please mark this reply as a solution by selecting Accept as Solution. This makes it easier for others to find answers to similar questions.
Thanks!
Hardit Bhatia
Microsoft Business Applications MVP
Blog | Twitter | LinkedIn | Facebook | YouTube | Email
hi there
as date field cant be delegated, an idea is to have a column in your SharePoint list date_serial or something that is the number equivalent of your date.
assign the result to a variable gblMaintExpense
Sum(
filter(source,
date_serial >= value(datepickerStart.selecteddate) &&
date_serial<= value(datepickerEnd.selecteddate)
),
Amount
)
set the label text to
Just to confirm, this was supposed to simply replace the filter criteria you had in your filter. You would still need the Filter function.
---
If you like this reply, please give kudos (Thumbs Up). And if this solves your problem, please mark this reply as a solution by selecting Accept as Solution. This makes it easier for others to find answers to similar questions.
Thanks!
Hardit Bhatia
Microsoft Business Applications MVP
Thanks for the reply @rubin_boer!
And I assume to feed that new column I have to get that done when I add a new entry?
I have never dealt with number equivalent of date. I will look that up.
@PowerAddict yes. So it looks like this:
Text(Sum(Filter(MaintenanceExpenses,DateDiff(ExpenseDatePickerFrom.SelectedDate, Created)>0, DateDiff(Created, ExpenseDatePickerTo.SelectedDate)>0,Amount),"[$-en-US]$#,###0.00")
Sounds good. Thank you for replying and trying it out. I will test it on my side and suggest something if the approach suggested by @rubin_boer doesn't work.
---
If you like this reply, please give kudos (Thumbs Up). And if this solves your problem, please mark this reply as a solution by selecting Accept as Solution. This makes it easier for others to find answers to similar questions.
Thanks!
Hardit Bhatia
Microsoft Business Applications MVP
Actually it worked. It was my mistake. I had made a mistake with the syntax.
Text(Sum(Filter(MaintenanceExpenses,DateDiff(ExpenseDatePickerFrom.SelectedDate, Created)>0, DateDiff(Created, ExpenseDatePickerTo.SelectedDate)>0),Amount),"[$-en-US]$#,###0.00")
Now I just need to tweak it so that it includes today's amounts. The Sum returned doesn't account for the entries done on the To date.