Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us in Toronto Sept 9th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
crusader_
Partner - Specialist
Partner - Specialist

Sum of previous month with Date in Dimension

Hi all,

I have an issue with calculating Sum of previous months.

tmp:

LOAD * INLINE [

  Consumed, Rest, Date

  100, 1000,'03.06.2014'

  200, 900,'26.06.2014'

  140, 700,'23.09.2014'

  300, 560,'07.05.2014'

  175, 260,'29.04.2014'

];

DateConsumed
29.04.2014175
07.05.2014300
03.06.2014100
26.06.2014200
23.09.2014140

I need to make a Straight table with 2 columns

1. Date

2. sum(Consumed) which belongs to previous 3 months.

Desired result is

DateSum
29.04.20140
07.05.2014175
03.06.2014475
26.06.2014475
23.09.2014300

I've made an expression in a such way

sum({<Date={">=$(=MonthStart(Date,-3))<=$(=MonthEnd(Date,-1))"}>} TOTAL Consumed)

and it shows me expected result but if only I choose exact date.

DateSUMM
26.06.2014475

How can I achieve desired result using Set Analysis only?

Thanks in avance.

Andrei

1 Solution

Accepted Solutions
tresesco
MVP
MVP

Set analysis doesn't get evaluated Row-wise; it filters data once for an object. Hence, directly using set analysis you would not get what you want, rather try with IF. This is one case when IF is the answer rather than set analysis. Otherwise, if you raelly want to stick to set analysis, another alternative and not-so-elegant way could be using synthetic dimension. Recommended better way - handle in the script.

View solution in original post

4 Replies
crusader_
Partner - Specialist
Partner - Specialist
Author

It should be very graceful solution but I can't find it.

If it possible at all.

Any help will be appreciated!

Thanks.

tresesco
MVP
MVP

Set analysis doesn't get evaluated Row-wise; it filters data once for an object. Hence, directly using set analysis you would not get what you want, rather try with IF. This is one case when IF is the answer rather than set analysis. Otherwise, if you raelly want to stick to set analysis, another alternative and not-so-elegant way could be using synthetic dimension. Recommended better way - handle in the script.

Not applicable

can you try to us intervalmatch ? by creating another table

mohsinqlik
Partner - Creator
Partner - Creator

Hi am facing the same scenario where i am not getting value of 6 months back when month as dimension is present.

Kindly share if you found a way to get the solution.