Qlik Community

New to QlikView

Discussion board where members can get started with QlikView.

Announcements
Qlik Certification Exam Sale - 40% off. Register by June 30, 2020. GET DETAILS
Highlighted
Honored Contributor II

Re: Open sheet should select always latest 5 Quarters ?

Not sure how you can achieve triggers but to get 5 Quarts combine try...

In back end

if(InQuarter(TempDate, today(),-1), 1, 0) as LastQtrFlag,

if(InQuarter(TempDate, today(),-2), 1, 0) as LastQtrFlag1,

if(InQuarter(TempDate, today(),-3), 1, 0) as LastQtrFlag2,

if(InQuarter(TempDate, today(),-4), 1, 0) as LastQtrFlag3,

if(InQuarter(TempDate, today(),-5), 1, 0) as LastQtrFlag4,

And in front end

if(GetSelectedCount(Year)=0,

aggr(Only({ < LastQtrFlag={1} >+<  LastQtrFlag1={1}>+<LastQtrFlag2={1}>+<LastQtrFlag3={1} >+< LastQtrFlag4={1}  >}  [Quarter Year]) ,[Quarter Year]), [Quarter Year])

This would give you by default always last 5 quarters with no selections but not sure how to set this inside a trigger.


Maybe someone else has better answer or can create a flag from this etc...

Highlighted
Valued Contributor

Re: Open sheet should select always latest 5 Quarters ?

Hi,

PFA, Solution.

Regards,

Pankaj

Highlighted
Honored Contributor II

Re: Open sheet should select always latest 5 Quarters ?

Dear,

a sample would have been enough - not the entire database ....

Anyhow:

Your row 65 does not make much sense, but you may rewrite it to

DUAL(FY_QM, RIGHT(FY_QM, 2) * 100 + MID(FY_QM, 2, 1) AS FY_QM_new

This would also convert the string into a (senseless, but) numeric expression, which then might be filtered.

For the on-open-event please then create a trigger

='=Rank(FY_QM_New)<=5'

HTH
Peter

Highlighted
New Contributor III

Re: Open sheet should select always latest 5 Quarters ?

Hi,

Thank you .

i wrote like below in script

AutoNumber(FYear & FY_QM, 'QuarterID') as [QuarterID]

and open sheet i have given as below in triggers

'=Rank(QuarterID)<=5'

It works. 🙂

Highlighted
Honored Contributor II

Re: Open sheet should select always latest 5 Quarters ?

Hi,

you need to be careful, as AUTONUMBER will read the values in the order of entry of the , i.e. if 2018 will be loaded before 2017, it will get a lower number as if it would be loaded in the numeric sequence.

Give it a try with

Data:

    LOAD *,

        AUTONUMBER(Year & Quarter)        AS id

    INLINE

        [Year, Quarter, Value

        2018, Q118, 2

        2018, Q218, 4

        2017, Q118, 5];

and watch the outcome ...