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

Sum currency column from SharePoint List based on date range

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.

1.png

My App and formula:

2.png

 

 

 

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!

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
PowerAddict
Super User
Super User

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

 

View solution in original post

12 REPLIES 12
PowerAddict
Super User
Super User

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

 

View solution in original post

rubin_boer
Super User
Super User

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

Text(gblMaintExpense,"#$00,00.00")

Thanks for replying @PowerAddict !

No success using this instead of Filter.

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

Blog | Twitter | LinkedIn | Facebook | YouTube  |  Email

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

Blog | Twitter | LinkedIn | Facebook | YouTube  |  Email

@PowerAddict,

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.

Glad I could help! Good luck with the rest of the app! Feel free to reach out in case of any questions!

 

You probably just need to change the To date condition to >=0 rather than >0.

 

Thanks!

Hardit Bhatia

Microsoft Business Applications MVP

Blog | Twitter | LinkedIn | Facebook | YouTube  |  Email

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 (1,615)