Skip to main content

QlikView App Dev

Discussion Board for collaboration related to QlikView App Development.

Announcements
Action-Packed Learning Awaits! QlikWorld 2023. April 17 - 20 in Las Vegas: REGISTER NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
aimee_johnson
Contributor III
Contributor III

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
aimee_johnson
Contributor III
Contributor III
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)

Before develop something, think If placed (The Right information | To the right people | At the Right time | In the Right place | With the Right context)
its_anandrjs

What is the format of CommonMonth field.

aimee_johnson
Contributor III
Contributor III
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.

aimee_johnson
Contributor III
Contributor III
Author

This returns 0.

its_anandrjs

Then just try this

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


Let me know about this.



aimee_johnson
Contributor III
Contributor III
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)

Before develop something, think If placed (The Right information | To the right people | At the Right time | In the Right place | With the Right context)
Anil_Babu_Samineni

Or this

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

Before develop something, think If placed (The Right information | To the right people | At the Right time | In the Right place | With the Right context)