Qlik Community

QlikView App Development

Discussion Board for collaboration related to QlikView App Development.

Highlighted
manoranjan_321988
New Contributor

Periodtype -Growth

Hi all,

 

Below is the script with two INline table

Metrics:
load * inline [
Metric,MetricId
'Sales',1
'Market Share',2
'Evolution Index',3
'Growth',4
];

PeriodTypes:
LOAD * INLINE [
PeriodID, PeriodTypeDescription
1, MTD
2, QTD
3, MQT
4, CTD
5, YTD
6, MAT
7, Weekly
8,R4W
];

 

in the front end i created two filters one is metric and periodtypedescription

 

metric have exp as =aggr(only({<MetricId={1,4},Metric=>}Metric),Metric)

in order to get the growth and sales only

 

period type have exp as =if(GetFieldSelections(Metric)='Growth',Aggr(Only({<PeriodID=-{7,8},PeriodTypeDescription=>}PeriodTypeDescription),PeriodTypeDescription),
Aggr(Only({<PeriodID-={8},PeriodTypeDescription=>}PeriodTypeDescription),PeriodTypeDescription)
)

 

1)in order to avoid weekly and R4W for the growth selection

2) in order to avoid weekly for the sales selection

 

but  issue is when i select growth no values of periodtype is associated to it in the filter.

for sales its working fine i m gettign the associated values correct and avoid the weekly.

 

 

1 Solution

Accepted Solutions
axk6666
New Contributor III

Re: Periodtype -Growth

if(GetFieldSelections(Metric)='Growth', Aggr(Only({<PeriodID-={7,8},PeriodTypeDescription= >}PeriodTypeDescription),PeriodID),
if(GetFieldSelections(Metric)='Sales', Aggr(Only({<PeriodID-={8},PeriodTypeDescription=>}PeriodTypeDescription),PeriodID),
Aggr(Only(PeriodTypeDescription),PeriodID)
))

 

use the above expression

View solution in original post

7 Replies
manoranjan_321988
New Contributor

Re: Periodtype -Growth

please reply me with suggestion

axk6666
New Contributor III

Re: Periodtype -Growth

if(GetFieldSelections(Metric)='Growth', Aggr(Only({<PeriodID-={7,8},PeriodTypeDescription= >}PeriodTypeDescription),PeriodID),
if(GetFieldSelections(Metric)='Sales', Aggr(Only({<PeriodID-={8},PeriodTypeDescription=>}PeriodTypeDescription),PeriodID),
Aggr(Only(PeriodTypeDescription),PeriodID)
))

 

use the above expression

View solution in original post

manoranjan_321988
New Contributor

Re: Periodtype -Growth

Hi I used below expression but the issue is when i select growth i m getting period type selection as unassociated values in period type filter.

for sales its working fine.

 

attached is the image. in image the marked as circle in the period type filter it has be associated values.

 

 

axk6666
New Contributor III

Re: Periodtype -Growth

create a list box with metric field and try to click the values in that listbox so that above expression which i pasted works

manoranjan_321988
New Contributor

Re: Periodtype -Growth

but coming to qliksense in the filter box its not working

axk6666
New Contributor III

Re: Periodtype -Growth

I am assuming what you are doing-:

see you have two tables

1,

2

so in front end u created a straight table for table 1 and you filtered the expression so u get

straight table 1:

metricid| metric

1|growth

2|sales

---------------------------------------

for table 2 u created  straight table 2 and in the expression you want to select the expression using if condition

like if getfield selection(metric)=sales than (expression1)  else (expression 2) 

straight table 2:

period id |period desc

1|xyz

2|yxs

here the main point lies with the function 'getfield selections()' .

you must take a new filter box with only mertic as field and try to click on it.

dont try to click on the straight table 1. 

 

 

 

Partner
Partner

Re: Periodtype -Growth

try this,

 

=IF(MetricId='4',Aggr(Only({<PeriodID-={7,8},PeriodTypeDescription=>}PeriodTypeDescription),PeriodTypeDescription),
IF(MetricId=1 ,Aggr(Only({<PeriodID-={8},PeriodTypeDescription=>}PeriodTypeDescription),PeriodTypeDescription),
Aggr(Only({<PeriodID-={8},PeriodTypeDescription=>}PeriodTypeDescription),PeriodTypeDescription)))

Thanks,

Nivethitha.