Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Set Anlaysis to show 2 months position

Hi all

I have several month snapshot data loaded and set analysis to show Mar 2013 and previous month, in this case is Feb 2013 when i selected Mar 2013 snapshot as below:

StatusMar 2013 =sum({$}OS)=sum({$}OS)Feb 2013 =sum({$<Year = {$(=only(Year) - $(=if(only(Month) = 1, 1, 0)))=sum({$<Year = {2013}, Month = {Feb}>} OS)
PF78,421,218,86779.5%5,107,813,44580.9%
Impaired15,890,083,95116.1%921,083,29014.6%
WL4,287,853,1684.3%282,361,1304.5%
98,599,155,985100.0%6,311,257,865100.0%

However, the Mar 2013 OS is wrong, I would think the set analysis should be okay, right?

Anyone could help. 

3 Replies
narender123
Specialist
Specialist

Hi,

1) for Mar2013

=sum({<Year={$(=max(Year))},Month={'Mar'}>}OS)    or    =sum({<Year={2013},Month={'Mar'}>}OS)

or

if you want the current month then

=sum({<Year={$(=max(Year))},Month={Month(Today())}>}OS)

2)for Feb2013

=sum({<Year={$(=max(Year))},Month={'Feb'}>}OS)  or         =sum({<Year={2013},Month={'Feb'}>}OS)

or

if you want the current month then

=sum({<Year={$(=max(Year))},Month={$(=Month(Today()-1))}>}OS)

Regards:

Narender

Not applicable
Author

Apologize, I did not elaborate my question clearly.

Actually I have Year (2012, 2013) and Month (Jan - Dec) listboxes, my requirement is when I select lets say 2013 Year and Jan Month, the straight table will show the Jan 2013 vs previos month position.

I use the set analysis as below

 

Jan 2013 =

sum({$}OS) (However,it give the lump sum of all month snapshots instead of the selected Jan 2013 position only)

 

Previous month =sum({$<Year = {$(=only(Year) - $(=if(only(Month) = 1, 1, 0)))}, Month = {$(=month(addmonths(MonthYear, -1)))}>} OS) (the previous month seem okay).

What go wrong with the sum({$}OS)?

somenathroy
Creator III
Creator III

Hi,

It makes easy to apply calendar related functions with Date rather than discrete year, month. Thus you may create a Date field with help of existing Year and Month fields. Hope attached file could help you.

Regards,

Som