Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
uday0994
Contributor
Contributor

Rolling 12 Months

Hi, I need to show Rolling 12 Months and Rolling 1 Month as a filter in Qlik sense. That filter  should apply only to one particular chart in a sheet. I have the below expression in the chart.

(100*sum({<QES.dim_plant.Plant=,QES.dim_plant.PlantType=>} aggr({<QES.dim_plant.Plant=,QES.dim_plant.PlantType=>}
only({<QES.dim_plant.Plant=,QES.dim_plant.PlantType=>} inspection_checkitems.a),inspection_checkitems.defect,[inspection_checkitems.component], Selected_MonthYear))
+50*sum({<QES.dim_plant.Plant=,QES.dim_plant.PlantType=>} aggr({<QES.dim_plant.Plant=,QES.dim_plant.PlantType=>}
only({<QES.dim_plant.Plant=,QES.dim_plant.PlantType=>} inspection_checkitems.b),inspection_checkitems.defect,[inspection_checkitems.component], Selected_MonthYear))
+10*sum({<QES.dim_plant.Plant=,QES.dim_plant.PlantType=>} aggr({<QES.dim_plant.Plant=,QES.dim_plant.PlantType=>}
only({<QES.dim_plant.Plant=,QES.dim_plant.PlantType=>} inspection_checkitems.c),inspection_checkitems.defect, [inspection_checkitems.component], Selected_MonthYear))
+sum({<QES.dim_plant.Plant=,QES.dim_plant.PlantType=>} aggr({<QES.dim_plant.Plant=,QES.dim_plant.PlantType=>}
only({<QES.dim_plant.Plant=,QES.dim_plant.PlantType=>} inspection_checkitems.d),inspection_checkitems.defect, [inspection_checkitems.component],Selected_MonthYear)))
/sum({<QES.dim_plant.Plant=,QES.dim_plant.PlantType=>} aggr({<QES.dim_plant.Plant=,QES.dim_plant.PlantType=>}
only(inspection_checkitems.sampling_size),report_no,Selected_MonthYear))

and i have created an Inline table where the field in inline table has  Rolling12Months and Rolling1Month and im using that as a filter and now I have to add an if condition to the above expression.

if(getsfieldselections(Rolling_Month='Rolling12Months', sum({<Selected_MonthYear ={"$(= '>=' & Date(AddMonths(Max(Selected_MonthYear), -11), 'MMM-YY')&'<'& Date(Max(Selected_MonthYear), 'MMM-YY') &)"}> }    the above expression,

if(getsfieldselections(Rolling_Month='Rolling1Month', sum({<Selected_MonthYear ={"$(= '>=' & Date(AddMonths(Max(Selected_MonthYear), -1), 'MMM-YY')&'<'& Date(Max(Selected_MonthYear), 'MMM-YY') &)"}> }    the above expression,otherwise the above expression))

 

if iselect Rolling12Months in filter then i should get 12months data and if selected Rolling1Month in filter, then should get 1 rolling  Month data. otherwise only the above expression(i.e., full data).

so, could anyone help me how to incorporate the if condition in the above expression.

 

Thank you.

 

0 Replies
Community Browser