Qlik Community

New to QlikView

Discussion board where members can get started with QlikView.

karllyon
New Contributor III

Set Analysis Problem

Hi all,

I am having a spot of bother around a set analysis.

I have a line chart and want to display values as at the same time in the previous year.  However, my issue surrounds the selected variable.  For example, the selected variable (Trimester) displays as follows:  2012-2 (denoting 2012 as the year and 2 as the semester). I really don't want to split up the variable into 2 user selections/fields (Year and Semester) and run set analysis against these as it will add a layer of possible user error.

The code I am using is:

 

=COUNT({<Trimester={"$(LEFT(Trimester, 4)-1) & '-' & RIGHT(Trimester, 1)"}>}DISTINCT(PERSON_ID))

have also tried

=COUNT({<Trimester={"$(LEFT(Trimester, 4)-1) + '-' + RIGHT(Trimester, 1)"}>}DISTINCT(PERSON_ID))

and just plain

=COUNT({<Trimester={"$(LEFT(Trimester, 4)-1)"}>}DISTINCT(PERSON_ID))

Have tried variants of the above and have come up feeling rather empty and dejected.

Any suggestions would be welcome.

Thanks

Sample file attached.

1 Solution

Accepted Solutions
filosofo
Contributor

Re: Set Analysis Problem

Use a variable and dollar sign expansion in the set analysis with single quotes. Check attached .qvw.

Regards, Sander

3 Replies
advait_thakur
Contributor III

Re: Set Analysis Problem

Hello Karl,

  I have tried your Set with many different approaches. Strange that it still shows Last Year 0.

I turn your chart to straight table to see the values.

I also observe that you have kept Last Year expression at Full Accumulation.

The below expression displays data for Last year though its not the correct way.

COUNT({<Trimester={'2011-2'}>}DISTINCT(PERSON_ID))

Please let me know once you find more about this.

Thanks,

Advait

filosofo
Contributor

Re: Set Analysis Problem

Use a variable and dollar sign expansion in the set analysis with single quotes. Check attached .qvw.

Regards, Sander

filosofo
Contributor

Re: Set Analysis Problem

Oh, and if you switch on full accumulation again for both expressions its cumulative again (open door). I switched this of to check if single values matched when changing the trimester. Regards.

Community Browser