Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
manoranjan_321988
Contributor
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.

 

 

Labels (2)
1 Solution

Accepted Solutions
Akhil_Reddy
Contributor III
Contributor III

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
Contributor
Contributor
Author

please reply me with suggestion

Akhil_Reddy
Contributor III
Contributor III

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

manoranjan_321988
Contributor
Contributor
Author

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.

 

 

Akhil_Reddy
Contributor III
Contributor III

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
Contributor
Contributor
Author

but coming to qliksense in the filter box its not working

Akhil_Reddy
Contributor III
Contributor III

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. 

 

 

 

nivethitha
Partner - Contributor II
Partner - Contributor II

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.