Qlik Community

Qlik Sense App Development

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

Announcements
BARC’s The BI Survey 19 makes it official. BI users love Qlik. GET REPORT
Highlighted
LEGION
New 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
Partner
Partner

Re: Perform a calculation for last 12 months

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
Partner
Partner

Re: Perform a calculation for last 12 months

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
New Contributor

Re: Perform a calculation for last 12 months

Thank you so much, this worked perfectly 🙂