Skip to main content
Announcements
See what Drew Clarke has to say about the Qlik Talend Cloud launch! READ THE BLOG
cancel
Showing results for 
Search instead for 
Did you mean: 
siddharthsoam
Partner - Creator II
Partner - Creator II

Show customized value in filter pane

Hi all,

I have a column quarter in my data with the following values.

Q1

Q2

Q3

Q4

Now I want two filter panes

1. Current quarter

2. Previous quarter

Values should be displayed as follows:

          Current                             Previous

values   Q2                                      Q1

values   Q3                                     Q2,Q1

values   Q4                                      Q3,Q2,Q1

Kindly help me implement this in qliksense

6 Replies
OmarBenSalem

stalwar1‌, do you have an idea on how to do this?

when we do as an expression:

= rangesum(above(count(Quarters),1,RowNo()))

we'll have the number of all above quarters of the current quarter;

to see all these quarters, I tried this:

=Concat(aggr(Only({$<Quarters = p({1<Quarters={$(=rangesum(above(count(Quarters),1,RowNo())))}>})>} Quarters ),Quarters),',')


Can you see what I'm doing wrong? And is there another way to do it?

Maybe within the script?

Anonymous
Not applicable

Hi Siddharth soam
I can think of a way to solve your problem, it is in the data file of load, with the functions Previous (when the previous value) and the peek (it returns the value of a record)

In the Script would be something similar to:

[Table]:

Load *, If([]=Previous([])+1 ,

               PEEK(value)+value,

    Resident Table1 ;

matteo901p
Partner - Contributor III
Partner - Contributor III

Hi,

in the filter panel i'm not sure that you can use Concat function; for resolve this case, i think that you must use script like this (for example):

MAP_QUARTER:

MAPPING LOAD * INLINE [

QUARTER , PREVIOUS

Q2 , Q1

Q3 , "Q2,Q1"

Q4 , "Q3,Q2,Q1"

];

NoConcatenate

QUARTER:

Load

QUARTER AS CURRENT,

ApplyMap('MAP_QUARTER',QUARTER,'#ND#') AS PREVIOUS

Resident QUARTER_TMP;

DROP TABLE QUARTER_TMP;

In the fillters, you must write this aggregation:

1)  =aggr(Only({1<CURRENT-={'Q1'}>}CURRENT),CURRENT)
2) =aggr(Only({1<CURRENT-={'Q1'}>}PREVIOUS),PREVIOUS)

The final result is:

filters_quarter.png

sunny_talwar

I am not clear as to what the OP is looking to get... may be a sample of raw data with expected output may help understand better

siddharthsoam
Partner - Creator II
Partner - Creator II
Author

I have 2 filter panes current quarter and previous quarter with values Q1, Q2 ,Q3, Q4

If I select Q4 from current quarter filter  then it should display only those quarters in previous quarter filter which are less than Q4  ie. Q1 , Q2 and Q3Capture.JPG

matteo901p
Partner - Contributor III
Partner - Contributor III

Try this script in a new app; this is the result that you want?:

NoConcatenate

QUARTER:

LOAD

'Q'&ROWNO() AS QUARTER

AutoGenerate 4;

MAP_QUARTER:

LOAD * INLINE [

QUARTER , PREVIOUS

Q2 , Q1

Q3 , Q2

Q3 , Q1

Q4 , Q3

Q4 , Q2

Q4 , Q1

];

In the fillters, you must write this aggregation:

1)  =aggr(Only({1<CURRENT-={'Q1'}>}CURRENT),CURRENT)
2) =aggr(Only({1<CURRENT-={'Q1'}>}PREVIOUS),PREVIOUS)