Qlik Community

Ask a Question

QlikView App Dev

Discussion Board for collaboration related to QlikView App Development.

Announcements
Our next Qlik Insider session will cover new key capabilities. Join us August 11th REGISTER TODAY
cancel
Showing results for 
Search instead for 
Did you mean: 
vijetas42
Specialist
Specialist

Values for current year quarter and previous year quarter in straight table

Hi All,

I have Year and Month in my data so, I have calculated yearquarter and previous yearquarter like below in script,

If(Ceil(Month/3)=0,Year&4,Year&Ceil(Month/3)) As YearQrtr
If((Ceil(Month/3)-1)=0,Year-1&4,Year&Ceil(Month/3)-1) As PrevYearQrtr

now, my requirement is when I select year 2019 and for that only Q1 data is available then in table it should show 

values for 20184 and 20191 columns respectively.Likewise, If I select 2018 and Q4 then it should show 20183 and 20184 values.

so, in variables i have taken each field for prevyearqtr and currentqtr and expression is like,

sum({<YearQrtr={'$(currentqtr )'}>}sales)

but, they are giving same values for both current and prev.

Could any one suggest on this.

TIA

Labels (3)
3 Replies
sunny_talwar

Why don't you try just this for the current qtr

Sum(sales)

and may be this for previous qtr

Sum({<YearQrtr = P(PrevYearQrtr), PrevYearQrtr>} sales)
vijetas42
Specialist
Specialist
Author

I am selecting values from year and Quarter filters. I dont have selection on YearQuarter field.
for this expression , Sum({<YearQrtr = P(PrevYearQrtr), PrevYearQrtr>} sales)
if, I select value from YearQrtr field it gives correct value but not on separate year and quarter selection
sunny_talwar

Try this in that case

 Sum({<YearQrtr = P(PrevYearQrtr), PrevYearQrtr, Year, Quarter>} sales)

Basically, ignore selections in all year and quarter fields and let YearQrtr drive your result