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

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Current Semester - Previous Semester in a chart

We have a very simple fact table, as shown below,  that updates every six months and where AWR may change every semester. I want to create a chart where I want to display ID, Name, Current AWR and Change AWR (Current AWR- Previous AWR). Can someone help design an expression for it. We only carry two current semesters, so in july-2012 records from June-2011 will be dropped. Expression is still excpected to work as (current - previous). Also there is a (Semester) as a filter on top of the chart. Irrespective of the semester selected, the expression should always give (current - previous AWR). Thanks.

IDNameAWRSemester
111Abc10June-2011
111Abc6December-2011
222Xyz5June-2011
222Xyz2December-2011
Labels (1)
1 Solution

Accepted Solutions
swuehl
Champion III
Champion III

Would be good if you could assign a date to your semester value, based on year and month, with a numerical representation.

Load

...

if(left(Semester,1)='J',makedate(right(Semester,4),6), makedate(right(Semester,4),12)) as SemesterDate,

...

from Table;

Since you only have the latest two Semester in your data, I think you can then calculate the change like

=sum({<Semester= , SemesterDate = {'$(=max({1}SemesterDate))'} >} AWR) - sum({<Semester= ,SemesterDate = {'$(=min({1}SemesterDate))'} >} AWR)

edit: attached a sample

View solution in original post

2 Replies
swuehl
Champion III
Champion III

Would be good if you could assign a date to your semester value, based on year and month, with a numerical representation.

Load

...

if(left(Semester,1)='J',makedate(right(Semester,4),6), makedate(right(Semester,4),12)) as SemesterDate,

...

from Table;

Since you only have the latest two Semester in your data, I think you can then calculate the change like

=sum({<Semester= , SemesterDate = {'$(=max({1}SemesterDate))'} >} AWR) - sum({<Semester= ,SemesterDate = {'$(=min({1}SemesterDate))'} >} AWR)

edit: attached a sample

Not applicable
Author

Thanks So much. It worked!