Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Sum revenue for a specific date

Hi, I have the following formula:

=AddMonths(Date(DATE#(CommonMonth,'YYYY/MM')),-1)

This returns the month previous to the selected date which is what I need, I now need to SUM(PrintRev) for the date this produces but I am confused about how to nest the SUM function,

Thanks

1 Solution

Accepted Solutions
Anonymous
Not applicable
Author

Ah I understand, in the formula I am converting 2017/10 to be something like 01/10/2017. This means when I go to look up my new date value in my CommonMonth column there is no such value as 01/10/2017, so I need to convert my date back to the original YYYY/MM format, and it should then find the correct values.

=Sum({<CommonMonth = {"$(=date(AddMonths(Date(DATE#(CommonMonth,'YYYY/MM')),-1),'YYYY/MM'))"}>} PrintRev)

I can confirm this has worked correctly for me. Thank you for your help.

View solution in original post

11 Replies
Anil_Babu_Samineni

Perhaps this?

Sum({<CommonMonth = {"$(=AddMonths(Date(DATE#(CommonMonth,'YYYY/MM')),-1))"}>} PrintRev)

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
its_anandrjs

What is the format of CommonMonth field.

Anonymous
Not applicable
Author

Format is YYYY/MM, when I run this formula it translates it to be: DD/MM/YYYY and converts to one month back which is the desire behaviour.

Anonymous
Not applicable
Author

This returns 0.

its_anandrjs

Then just try this

SUM( {<CommonMonth = {"$(=AddMonths(GetFieldSelections(Order_Date),-1))"}>} PrintRev)


Let me know about this.



Anonymous
Not applicable
Author

This returns 0.

its_anandrjs

Oh My bad maybe this is

SUM( {<CommonMonth = {"$(=AddMonths(GetFieldSelections(CommonMonth ),-1))"}>} PrintRev)


Better if you can share sample date for this.

Anil_Babu_Samineni

You can re write this

Sum({<CommonMonth = {"$(=AddMonths(Date(DATE#(CommonMonth,'YYYY/MM'), 'YYYY/MM'),-1))"}>} PrintRev)

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
Anil_Babu_Samineni

Or this

Sum({<CommonMonth = {"$(=AddMonths(Date(DATE#(max(CommonMonth),'YYYY/MM'), 'YYYY/MM'),-1))"}>} PrintRev)

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful