Qlik Community

Ask a Question

App Development

Discussion board where members can learn more about Qlik Sense App Development and Usage.

Announcements
April 22, 2PM EST: Learn about GeoOperations in Qlik Sense SaaS READ MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
LEGION
Contributor
Contributor

Perform a calculation for last 12 months

Hello, I am struggling with a calculation. I am calculating NETT sales using the following formula: 

(((Sum({<TCODE={'IN'}>} AMOUNT))-(Sum({<TCODE={'CN'}>} AMOUNT)))-((Sum({<TCODE={'IN'}>} PROFIT))-(Sum({<TCODE={'CN'}>} PROFIT))))

This works just fine, but I only want to perform this calculation on data that fall in the last 12 months, my date field is [TXDATE].

Unless this is not possible and someone could please point me in the correct direction.

 

Thank you in advance 🙂

Labels (1)
1 Solution

Accepted Solutions
martinpohl
Partner
Partner

change to

(((Sum({<TCODE={'IN'}, TXDATE={">=$(=date(addmonths(today(),-12)))"}>} AMOUNT))-(Sum({<TCODE={'CN'}, TXDATE={">=$(=date(addmonths(today(),-12)))"}>} AMOUNT)))-((Sum({<TCODE={'IN'}, TXDATE={">=$(=date(addmonths(today(),-12)))"}>} PROFIT))-(Sum({<TCODE={'CN'}, TXDATE={">=$(=date(addmonths(today(),-12)))"}>} PROFIT))))

 

Regards

View solution in original post

2 Replies
martinpohl
Partner
Partner

change to

(((Sum({<TCODE={'IN'}, TXDATE={">=$(=date(addmonths(today(),-12)))"}>} AMOUNT))-(Sum({<TCODE={'CN'}, TXDATE={">=$(=date(addmonths(today(),-12)))"}>} AMOUNT)))-((Sum({<TCODE={'IN'}, TXDATE={">=$(=date(addmonths(today(),-12)))"}>} PROFIT))-(Sum({<TCODE={'CN'}, TXDATE={">=$(=date(addmonths(today(),-12)))"}>} PROFIT))))

 

Regards

View solution in original post

LEGION
Contributor
Contributor
Author

Thank you so much, this worked perfectly 🙂